This file contains hidden or 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
anchors=document.querySelectorAll("table a"); | |
for (i=0; i < anchors.length; i++) { | |
if (anchors[i].innerText.match(/(to|get).*\(\)/) ) { | |
var method = anchors[i].innerHTML; | |
method=method.substring(0, method.length-2); | |
console.log(method, " -- ", new Date()[method]()); } | |
} |
This file contains hidden or 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
#!/bin/bash | |
APIKEY="newdeveloper" | |
function turnOff { | |
curl -X PUT -d"{\"on\": false }" http://192.168.2.142/api/$APIKEY/lights/$1/state | |
} | |
turnOff 1 | |
turnOff 3 |
This file contains hidden or 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
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.10.1/jquery.js"></script> | |
<script src="http://canjs.us/release/latest/can.jquery.js"></script> | |
<script src="http://canjs.com/release/latest/can.view.mustache.js"></script> | |
<script src="can.mustache.defaultBindings.js"></script> | |
<script id="template" type="text/mustache"> | |
<h1>Knockout-esque <code>value</code> binding</h1> | |
{{#newAnimal}} | |
<input type="text" {{value name }} placeholder="Name of animal"> | |
<input type="text" {{value favoriteFood}} placeholder="Favorite food"> |
This file contains hidden or 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
#!/bin/sh | |
# | |
# This script will make WinMerge your default tool for diff and merge. | |
# It must run inside git bash (on Windows) | |
# | |
# If your WinMerge is in other place then this one, please edit | |
WINMERGE_SCRIPT="~/winmerge-merge.sh" |
This file contains hidden or 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
#setting the stage... creating 3 separate repos | |
mkdir animals; cd animals/; echo "Animals" > README; git init; git add .; git commit -m "Animals readme"; cd .. | |
mkdir dogs; cd dogs/; echo "Dogs" > README; git init; git add .; git commit -m "Dogs readme"; cd .. | |
mkdir cats; cd cats/; echo "Cats" > README; git init; git add .; git commit -m "Cats readme"; cd .. | |
#putting stuff in boxes for the move... | |
cd cats; mkdir cats #making /cats inside of cats, because in /animals we want /cats to be a subdir | |
git mv README cats #this line needs to me more appropriate to the contents of your actual child repo | |
git commit -m "Prepare cats for merge into animals"; cd .. |
This file contains hidden or 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
var dupeIds = [], dupeIdsString; | |
$('[id]').each(function(){ | |
var ids = $('[id="' + this.id + '"]'); | |
if (ids.length > 1 && ids[0] == this) { | |
dupeIds.push(this.id); | |
} | |
}); | |
dupeIdsString = dupeIds.concat(", "); |
This file contains hidden or 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
require 'cgi' | |
match = 'track.updateNowPlaying' | |
ngrep_command = "ngrep -W byline '#{match}'" | |
puts "Watching network for iTunes Store now playing previews..." | |
IO.popen(ngrep_command).each do |line| | |
if line.match(/\=#{match}/) |
This file contains hidden or 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
match = 'nowplaying' | |
ngrep_command = "ngrep -W byline '#{match}' port 5353" | |
puts "Watching network for iTunes mDNS #nowplaying announces..." | |
IO.popen(ngrep_command).each do |line| | |
if line.match(/\##{match}/) | |
pattern = /nowplaying-title=(?<title>[\w ]+).+nowplaying-artist=(?<artist>[\w ]+).+nowplaying-album=(?<album>[\w ]+)/ |
This file contains hidden or 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
SSH_ENV="$HOME/.ssh/environment" | |
# start the ssh-agent | |
function start_agent { | |
echo "Initializing new SSH agent..." | |
# spawn ssh-agent | |
ssh-agent | sed 's/^echo/#echo/' > "$SSH_ENV" | |
echo succeeded | |
chmod 600 "$SSH_ENV" | |
. "$SSH_ENV" > /dev/null |
This file contains hidden or 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
#!/usr/bin/env ruby | |
class String | |
def -(other) | |
self.index(other) == 0 ? self[other.size..self.size] : nil | |
end | |
end | |
if ARGV.length < 2 | |
puts |