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
this.toObj = function () { | |
var obj = {}; | |
for (var p in this) { | |
// For some reason if this has more than one if statement | |
// or if the if is checking more than one thing via "||" it | |
// completely ignores it and assumes it's true | |
if (typeof this[p] != 'function') { | |
obj[p] = this[p]; | |
} |
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
export GOROOT="$HOME/.go" # Go build | |
[[ ! "$PATH" =~ "$GOROOT" ]] && export PATH="$PATH:$GOROOT/bin" # Add bin to path | |
export GOPATH="$HOME/Programming/Go" # Go project path |
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 reverse = function(array) { | |
var i = array.length | |
, arr = []; | |
while(--i >= 0) { | |
arr.push(array[i]) | |
} | |
return arr; | |
} |
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
package main | |
import ( | |
"fmt" | |
) | |
func Reverse(slice []string) []string { | |
ret := make([]string, len(slice), cap(slice)) | |
for i := len(slice) - 1; i >= 0; i-- { |
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
{ | |
"env": { | |
// Go executable, stdlib, etc | |
"GOROOT": "$HOME/.go" | |
// Custom packages, and packages installed from go get and go install | |
"GOPATH": "$HOME/Programming/go" | |
} | |
} |
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
package main | |
import ( | |
"flag" | |
"fmt" | |
"os" | |
"os/exec" | |
"time" | |
) |
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
// Style 1 | |
var config = { | |
spdy: true, | |
ssl: { | |
key: '/home/larz/Desktop/server.key', | |
cert: '/home/larz/Desktop/server.crt' | |
} | |
}; | |
module.exports = config; |
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
<?php | |
// Get the "API_SECRET" variable from our shell session | |
$api_secret = getenv('API_SECRET'); | |
// Same as above, but using a Superglobal | |
$api_secret = $_ENV['API_SECRET']; | |
// You can use phpinfo to show all the environmental variables you can use. | |
phpinfo(INFO_ENVIRONMENT); |
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
#!/bin/bash | |
echo -e "Hi, I'm Douglas Crockford. Do you have an issue or a pull request?\n" | |
ask() { | |
read Type | |
if [[ "$Type" =~ "request" ]]; then | |
echo "You have the source." | |
elif [[ "$Type" =~ "issue" ]]; then |
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
-- For use with the ComputerCraft Minecraft mod. http://computercraft.info/ | |
-- | |
-- To use, just get a mining turtle then create a script | |
-- do: edit miner | |
-- then write this script(I know, tedious). | |
-- Once finished just do `miner` to start finding diamonds! | |
-- Keeps track of up and down movements | |
downCounter = 0 | |
upCounter = 0 |