Skip to content

Instantly share code, notes, and snippets.

@johnvilsack
johnvilsack / getJSON
Created June 24, 2014 19:48
getJSON in Go
package main
import (
"encoding/json"
"fmt"
)
type itemResult struct {
Query string `json:"query"`
Count int `json:"count"`
package main
import (
"fmt"
)
type ZipCoder interface {
fullName() string
}
[ROOT] # source golang-crosscompile/crosscompile.bash
-sh: `go-alias': not a valid identifier
-sh: `go-crosscompile-build': not a valid identifier
-sh: `go-crosscompile-build-all': not a valid identifier
-sh: `go-all': not a valid identifier
-sh: `go-build-all': not a valid identifier
-sh: go-alias: command not found
-sh: go-alias: command not found
-sh: go-alias: command not found
-sh: go-alias: command not found
@johnvilsack
johnvilsack / gist:8984172
Created February 13, 2014 21:26
Javascript Console Block for Chrome
<script type="text/javascript">
(function(){
var _z = console;
Object.defineProperty( window, "console", {
get : function(){
if( _z._commandLineAPI ){
throw "Sorry, Can't exceute scripts!";
}
return _z;
},
@johnvilsack
johnvilsack / ST3_PREFERENCES
Created January 31, 2014 17:28
ST3_PREFERENCES
{
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/Theme - Flatland/Flatland Monokai.tmTheme",
"draw_white_space": "all",
"fade_fold_buttons": false,
"find_selected_text": true,
"font_face": "Source Code Pro for Powerline",
"font_size": 19,
"highlight_line": true,
@johnvilsack
johnvilsack / ST3_Keybindings
Created January 31, 2014 17:28
ST3_Keybindings
[
{"keys": ["super+`"], "command": "unexpand_tabs"},
{"keys": ["option+`"], "command": "expand_tabs"}
]
@johnvilsack
johnvilsack / 0_reuse_code.js
Created January 15, 2014 18:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<HTML>
<HEAD>
<title>User Login</title>
<!-- Twitter Bootstrap stylesheet -->
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
</HEAD>
<BODY>
@johnvilsack
johnvilsack / gist:6831252
Created October 4, 2013 19:21
Pre-JSON script for LED toggling
var bone = require('bonescript');
var state = bone.LOW;
bone.pinMode("USR0", bone.OUTPUT);
bone.pinMode("USR1", bone.OUTPUT);
bone.pinMode("USR2", bone.OUTPUT);
bone.pinMode("USR3", bone.OUTPUT);
setInterval(toggle, 10);
function toggle() {
@johnvilsack
johnvilsack / generator
Created June 20, 2013 21:31
Iterator for PHP
function factory($strt, $stop, $plus = 1) {
for ($n = $strt; $n <= $stop; $n += $plus) {
yield $n;
}
}
foreach(factory(1,10) as $output) {
echo $output . "\n";
}