Site Tools


onny:notizen:programmierung

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
onny:notizen:programmierung [2022/11/25 09:28] – [postgresql] 10.100.0.1onny:notizen:programmierung [2023/03/24 14:48] – [javascript] 10.100.0.1
Line 56: Line 56:
 date = datetime.datetime.now().strftime("%d.%m.%Y") date = datetime.datetime.now().strftime("%d.%m.%Y")
 </code> </code>
 +
 requests requests
 +
 <code python> <code python>
 import requests import requests
Line 66: Line 68:
 if (upstream_head.headers['content-type'] == "text/html;charset=UTF-8" or upstream_head.headers['content-type'] == "text/html; charset=UTF-8"): if (upstream_head.headers['content-type'] == "text/html;charset=UTF-8" or upstream_head.headers['content-type'] == "text/html; charset=UTF-8"):
     upstream_response = upstream_response.replace("//thepiratebay.org","")     upstream_response = upstream_response.replace("//thepiratebay.org","")
 +</code>
 +
 +class example
 +
 +<code python>
 +class Planday:
 +  auth_url = 'https://id.planday.com/connect/token'
 +  client_id = '1234'
 +  access_token = ''
 +
 +  def authenticate(self):
 +    payload = {
 +      'client_id': self.client_id,
 +      'refresh_token': 'qyS6qt9yNEqygE1mMQtRzA',
 +      'grant_type': 'refresh_token'
 +    }
 +    headers = {
 +      'Content-Type': 'application/x-www-form-urlencoded'
 +    }
 +    session = requests.session()
 +    session.trust_env = False
 +    response = session.request("POST", self.auth_url, headers=headers, data=payload)
 +    response = json.loads(response.text)
 +    self.access_token = response['access_token']
 +
 +planday = Planday()
 +planday.authenticate()
 </code> </code>
 ==== ponyorm ==== ==== ponyorm ====
Line 265: Line 294:
  
 <code javascript> <code javascript>
-var anchors = document.getElementsByClassName('wp-block-navigation-item__content'); +# old: var anchors = document.getElementsByClassName('wp-block-navigation-item__content'); 
-for(var i 0; i < anchors.length; i++{ +let allCheckBox document.querySelectorAll('.shapes'
-    var anchor anchors[i]; + 
-    anchor.onclick function() { +  allCheckBox.forEach((checkbox) => {  
-        console.log('clicked');+  checkbox.addEventListener('change', (event) => { 
 +    if (event.target.checked) { 
 +      console.log(event.target.value)
     }     }
-}+  }
 +})
 </code> </code>
  
Line 288: Line 320:
 </code> </code>
  
-querySelector+querySelector, get child element
  
 <code javascript> <code javascript>
-var multicolumnHeadline = document.querySelector('div.multicolumn ul li:nth-child(1) h3').textContent;+var h3 = document.querySelector('div.multicolumn ul li:nth-child(1) h3') 
 +console.log(h3.textContent); 
 +h3.querySelector('span');
 </code> </code>
  
Line 299: Line 333:
 var productAccordion = document.querySelectorAll('div.product__accordion'); var productAccordion = document.querySelectorAll('div.product__accordion');
 productAccordion[1].style.display = "none"; productAccordion[1].style.display = "none";
 +</code>
 +
 +get next or previous element
 +
 +<code javascript>
 +document.getElementById('foo2').nextSibling; // #foo3
 +document.getElementById('foo2').previousSibling; // #foo1
 </code> </code>
 ==== vuejs ==== ==== vuejs ====
onny/notizen/programmierung.txt · Last modified: 2023/11/07 15:40 by 127.0.0.1