This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import Cocoa | |
import PlaygroundSupport | |
PlaygroundPage.current.needsIndefiniteExecution = true | |
//----------------------------------- | |
// Source: https://www.appcoda.com/grand-central-dispatch/ | |
func queuesWithQosExample() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reference from: https://github.com/Reactive-Extensions/RxJS/blob/master/doc/howdoi/eventemitter.md | |
var hasOwnProp = {}.hasOwnProperty; | |
function createName (name) { | |
return '$' + name; | |
} | |
function Emitter() { | |
this.subjects = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use the Raspberry Pi to detect motion and send an email | |
# When the motion sensor is tripped it will send an email with a duration of motion detection. The duration is so that it might be easier to determine if the motion sensor is being set off by an intruder or something else like changes in light. | |
# All you need is the Pi and a motion sensor. The motion sensor that I used is the Parallax PIR Sensor (Rev B). | |
# My setup is as follows | |
# pin1 -> Vcc on PIR Sensor | |
# pin15 -> Out on PIR Sensor | |
# pin6 -> GND on PIR Sensor | |
import RPi.GPIO as GPIO | |
import smtplib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// working one pulled from https://github.com/nytimes/svg-crowbar/issues/31#issuecomment-421054505 | |
// Changing that to ss.hasOwnProperty('cssRules') fixed the issue for me. | |
!function(){var t='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">';window.URL=window.URL||window.webkitURL;var e,n,o=document.body,l={xmlns:"http://www.w3.org/2000/xmlns/",xlink:"http://www.w3.org/1999/xlink",svg:"http://www.w3.org/2000/svg"};function s(t){var e="untitled";t.id?e=t.id:t.class?e=t.class:window.document.title&&(e=window.document.title.replace(/[^a-z0-9]/gi,"-").toLowerCase());var n=window.URL.createObjectURL(new Blob(t.source,{type:"text/xml"})),l=document.createElement("a");o.appendChild(l),l.setAttribute("class","svg-crowbar"),l.setAttribute("download",e+".svg"),l.setAttribute("href",n),l.style.display="none",l.click(),setTimeout(function(){window.URL.revokeObjectURL(n)},10)}e=[window.document],n=[],iframes=document.querySelectorAll( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git remote add <other-fork-alias> <other-fork-URL> | |
git checkout <branch> | |
git fetch <other-fork-alias> | |
git cherry-pick <commit-hash> | |
git push <your-fork-alias> | |
git remote remove <other-fork-alias> | |
git remote -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
$.ajax({ | |
type: "GET" , | |
url: "downloads/updates.xml" , | |
dataType: "xml" , | |
success: function(xml) { | |
var items = [] | |
$(xml).find('item').each(function(){ | |
var item = $(this) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// debounce-throttle.swift | |
// | |
// Created by Simon Ljungberg on 19/12/16. | |
// License: MIT | |
// | |
import Foundation | |
extension TimeInterval { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* USB HID Keyboard scan codes as per USB spec 1.11 | |
* plus some additional codes | |
* | |
* Created by MightyPork, 2016 | |
* Public domain | |
* | |
* Adapted from: | |
* https://source.android.com/devices/input/keyboard-devices.html | |
*/ |