Skip to content

Instantly share code, notes, and snippets.

View LukasPolak's full-sized avatar

Lukas Polak LukasPolak

View GitHub Profile
tell application "System Preferences"
activate
set the current pane to pane id "com.apple.preference.notifications"
end tell
tell application "System Events" to tell window 1 of process "System Preferences"
repeat with r in rows of table 1 of scroll area 1
if name of UI element 1 of r is not "Do Not Disturb" then
set selected of r to true
tell radio button "Banners" of radio group 1 of group 1 to if value is 0 then click
@LukasPolak
LukasPolak / share-your-experience-hooks.js
Created August 2, 2019 08:34
Share your experience - 02.08.2019 - FunctionalComponentWithHooks
const FunctionalComponentWithHooks = () => {
const [{ disabled }, setValue] = useState({ disabled: true });
useEffect(() => {
setTimeout(() => {
setValue({ disabled: !disabled });
}, 1000);
}, []);
return (
@LukasPolak
LukasPolak / medium-12-11-2018.js
Last active November 19, 2018 06:00
Copy Array/Object to your clipboard with browser built-in Developer Tools
// 1. Go to the https://www.wearedevelopers.com/speakers/ website and open the web console
// 2. Declare a variable with an empty array.
// Don’t be afraid of undefined. It’s because all you are doing is declaring a variable.
let speakersArr = [];
// 3. Find every occurrence of speaker name, in this case, it is a `.team-meta h3`.
// Then every element that was found should be converted do `Array` (now it is a `NodeList`).
const speakersElements = Array.from(document.querySelectorAll('.team-meta h3'));
// 4. Map through every speaker and push the speaker `textContent` to
// `speakersArr` declared at the top of the page.
speakersElements.map(speaker => {
@LukasPolak
LukasPolak / words_dictionary.json
Last active August 11, 2018 09:28
Array of 370k english words for JS. Edited copy of words_dictionary.json file from https://github.com/dwyl/english-words repository
This file has been truncated, but you can view the full file.
["a","aa","aaa","aah","aahed","aahing","aahs","aal","aalii","aaliis","aals","aam","aani","aardvark","aardvarks","aardwolf","aardwolves","aargh","aaron","aaronic","aaronical","aaronite","aaronitic","aarrgh","aarrghh","aaru","aas","aasvogel","aasvogels","ab","aba","ababdeh","ababua","abac","abaca","abacay","abacas","abacate","abacaxi","abaci","abacinate","abacination","abacisci","abaciscus","abacist","aback","abacli","abacot","abacterial","abactinal","abactinally","abaction","abactor","abaculi","abaculus","abacus","abacuses","abada","abaddon","abadejo","abadengo","abadia","abadite","abaff","abaft","abay","abayah","abaisance","abaised","abaiser","abaisse","abaissed","abaka","abakas","abalation","abalienate","abalienated","abalienating","abalienation","abalone","abalones","abama","abamp","abampere","abamperes","abamps","aband","abandon","abandonable","abandoned","abandonedly","abandonee","abandoner","abandoners","abandoning","abandonment","abandonments","abandons","abandum","abanet","abanga","abanic","abannition"