Skip to content

Instantly share code, notes, and snippets.

View twhite96's full-sized avatar
☢️
Cookin

tiff twhite96

☢️
Cookin
View GitHub Profile
@kyleshevlin
kyleshevlin / index.js
Created September 25, 2020 21:41
Boolean operators don't distribute
// I see this mistake often (and have made it myself before)
// What's the bug with this function?
function isFavSeason(season) {
return season === 'spring' || 'summer' ? 'yes' : 'no'
}
// Let's try it and find out
console.log(isFavSeason('spring')) // yes
console.log(isFavSeason('summer')) // yes
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: green; icon-glyph: file-code;
const getModule = importModule("getModule");
const documentDirectory = FileManager.iCloud().documentsDirectory();
module.exports = async ({ moduleName, url, forceDownload = false }) => {
if (moduleExists(moduleName) && !forceDownload) {
return importModule(moduleName);
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: green; icon-glyph: file-code;
const getString = importModule('getString');
const documentDirectory = FileManager.iCloud().documentsDirectory();
const header = `// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-gray; icon-glyph: file-code;`;
@gruber
gruber / Paste URL From Safari Tab.scpt
Created June 29, 2015 00:01
Paste URL From Safari Tabs
set _old_delims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {""}
tell application "System Events"
set _current_app to name of the first process whose frontmost is true
end tell
tell application "Safari"
set _urls to {}
repeat with i from 1 to 6 -- how many Safari windows to show URLs from
@paitonic
paitonic / expressjs-api-test-with-jasmine-and-request.md
Last active April 19, 2021 14:16
ExpressJS - API Tests with Jasmine and request

ExpressJS - API Tests with Jasmine and request

What am I trying to solve

I was trying to solve an issue with starting the ExpressJS server before each single test and closing it after each test completes, just to make sure each test is running under the same conditions.

Here is the error I ran into while trying to run the tests

$ ./node_modules/jasmine/bin/jasmine.js
Started
started
@jonathantneal
jonathantneal / README.md
Last active April 25, 2021 00:23
CSS Container Queries Notes

CSS Container Queries Notes

Detecting a layout container

  1. If the target rule represents a style rule;
  2. If the target rule style contains a fallback contain property; 1. If the fallback contain property represents a layout container;
    1. For each element matching the selector of the target rule;
    2. Add the element to the list of layout containers, then;
  3. Add a fallback layout containment rule for that specific element.
@lmammino
lmammino / example.ts
Created August 3, 2021 19:03
Get your public IP in TypeScript
import { getMyPublicIp } from './utils.ts'
getMyPublicIp
.then(console.log)
.catch(console.error)
@miklb
miklb / jekyl_frontmatter_textexpander.js
Last active October 20, 2021 12:41
A TextExpander snippet for Jekyll Front Matter. Enter a title, outputs front matter including a slug for the permalink.
var title = '%filltext:name=Title%';
slug = title.replace(/[^\w\s]/gi, '');
var newslug = title.split(" ").join("-");
var dt = new Date();
TextExpander.appendOutput("---\n");
TextExpander.appendOutput("layout: post \n");
TextExpander.appendOutput("title: " + '"' +title + '"'+ "\n");
TextExpander.appendOutput("tags: \n");
<!DOCTYPE html>
<html lang="en" id="facebook" class="no_js">
<head><meta charset="utf-8" /><meta name="referrer" content="origin-when-crossorigin" id="meta_referrer" /><script>window._cstart=+new Date();</script><script>function envFlush(a){function b(c){for(var d in a)c[d]=a[d];}if(window.requireLazy){window.requireLazy(['Env'],b);}else{window.Env=window.Env||{};b(window.Env);}}envFlush({"ajaxpipe_token":"AXgoZ_XrDkw8k1Lr","lhsh":"rAQGMMCaH","khsh":"0`sj`e`rm`s-0fdu^gshdoer-0gc^eurf-3gc^eurf;1;enbtldou;fduDmdldourCxO`ld-2YLMIuuqSdptdru;qsnunuxqd;rdoe-0unjdojnx-0unjdojnx0-0gdubi^rdbsduOdv-0`sj`e`r-0q`xm`r-0StoRbs`qhof-0mhoj^q`xm`r","timeslice_heartbeat_config":{"pollIntervalMs":33,"idleGapThresholdMs":60,"ignoredTimesliceNames":{"requestAnimationFrame":true,"Event listenHandler mousemove":true,"Event listenHandler mouseover":true,"Event listenHandler mouseout":true,"Event listenHandler scroll":true},"enableOnRequire":false},"shouldLogCounters":false,"timeslice_categories":{"react_render":true,"reflow":true}})
const alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
const input = [
"I really",
"ScriptJava",
["and I", "an it's"],
{
m1: "love",
m2: "!namuh retteb a"
},