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
define('SimplePromise', [], function() { | |
var constructor = function() { | |
_ = this; | |
var theHandler = function(response) {}; | |
var theFunction= function() {}; | |
var theThis; | |
this.then = function(fn, thisObject) { | |
handler = fn; |
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 aliases | |
alias gsts='git status --short' | |
alias c='git commit ' | |
alias gd='git diff ' | |
alias clean='git clean -f' | |
alias gl='git l' | |
#git function to add last parameter of last command via git add (used after a diff) | |
gal() { |
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
window.GameOfLife = function(rows, cols, generations, timeout) { | |
rows = rows || 10; | |
cols = cols || 10; | |
generations = generations || -1; | |
timeout = timeout || 100; | |
var setupBoard = function() { | |
arr = []; | |
for(var rowId=0;rowId<rows;rowId++) { |
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
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ | |
/* */ | |
/* Simple node js module to get distance between two coordinates. */ | |
/* */ | |
/* Code transformed from Chris Veness example code - please refer to his website for licensing */ | |
/* questions. */ | |
/* */ | |
/* */ | |
/* Latitude/longitude spherical geodesy formulae & scripts (c) Chris Veness 2002-2011 */ | |
/* - www.movable-type.co.uk/scripts/latlong.html */ |
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
#!/usr/bin/env zsh | |
function pre { | |
echo -n '<pre style="word-wrap: break-word;">' | |
perl -pe '$| = 1; s/&/&/g; s/</</g; s/>/>/g; s/$\\n/<br>/' | |
echo '</pre>' | |
} | |
cd ~/Documents/Projects/clauswitt.com/ | |
./deploy.sh | pre |
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
on replaceString(theText, oldString, newString) | |
local ASTID, theText, oldString, newString, lst | |
set ASTID to AppleScript's text item delimiters | |
try | |
considering case | |
set AppleScript's text item delimiters to oldString | |
set lst to every text item of theText | |
set AppleScript's text item delimiters to newString | |
set theText to lst as string | |
end considering |
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
tell application "Safari" | |
activate | |
open location "http://gist.github.com" | |
end tell | |
delay 1 | |
tell application "System Events" | |
tell process "Safari" | |
keystroke "v" using {command down} | |
end tell | |
end tell |
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
var fs = require('fs'); | |
fs.writeFile("file.txt", "This is the new file content.", function(err) { | |
if(err) { | |
return console.log(err); | |
} | |
console.log("The file was saved!"); | |
}); |
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
#ifdef GL_ES | |
precision highp float; | |
#endif | |
// General parameters | |
uniform sampler2D from; | |
uniform sampler2D to; | |
uniform float progress; | |
uniform vec2 resolution; | |
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
## mysql::master | |
ruby_block "store_mysql_master_status" do | |
block do | |
node.set[:mysql][:master] = true | |
m = Mysql.new("localhost", "root", node[:mysql][:server_root_password]) | |
m.query("show master status") do |row| | |
row.each_hash do |h| | |
node.set[:mysql][:master_file] = h['File'] | |
node.set[:mysql][:master_position] = h['Position'] | |
end |
NewerOlder