Skip to content

Instantly share code, notes, and snippets.

<snippet>
<content><![CDATA[
fmt.Printf("%+v\n", $1)
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>debug</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.go</scope>
</snippet>
@bwiggs
bwiggs / pginsert.sql
Created June 3, 2015 18:49
Postgres Insert row with only an auto increment column
INSERT INTO [table] (id) values (default);
@bwiggs
bwiggs / ng-dump.sublime-snippet
Created February 25, 2015 20:39
A simple html pre tag that dumps an angular object.
<snippet>
<content><![CDATA[
<pre>{{ ${1:object} | json}}</pre>
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>dump</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>text.html</scope>
<description>pre tab to deump an ng object using the json filter</description>
</snippet>
@bwiggs
bwiggs / new_engine_refactor.go
Created February 25, 2015 04:16
limetext refactor snippet
// newQmlEngine creates a new qml engine. Destroys the old one if set.
//
// This is needed to re-load qml files to get the new file contents from disc as
// otherwise the old file would still be what is referenced.
func (t *qmlfrontend) newQmlEngine() (err error) {
if t.engine != nil {
// TODO(.): calling this appears to make the editor *very* crash-prone, just let it leak for now
// engine.Destroy()
t.engine = nil
}
params := url.Values{
"Condition": []string{"New"},
"Operation": []string{"ItemSearch"},
"SearchIndex": []string{"Books"},
"Title": []string{"ruby microscope"},
}
@bwiggs
bwiggs / keybase.md
Last active March 12, 2017 18:04
keybase.md

Keybase proof

I hereby claim:

  • I am bwiggs on github.
  • I am bwigginton (https://keybase.io/bwigginton) on keybase.
  • I have a public key ASDUuJfyp5_3y5dZK7UHwIU5997em3uXsuZdAcfFxf5qoAo

To claim this, I am signing this object:

@bwiggs
bwiggs / ConstructorProxy.js
Created July 15, 2014 14:22
ConstructorProxy.js
function Person() {
this.name = 'Bob'
}
constructorProxy = (constructorFn, args) ->
Proxy = ->
constructorFn.apply(this, args)
this.name = 'Dave'
Proxy:: = Object.create constructorFn::
Proxy
@bwiggs
bwiggs / genpasswd.sh
Created June 4, 2014 17:46
CLI Password Generator with openssl
function genpasswd() {
let passwordLength=${1:-48}
openssl rand -base64 $passwordLength | cut -c 1-$passwordLength
}
# $ genpasswd 24
# qPE5rpQOF74k8SoibCFzhlwp
function TimeDurationDirective() {
var tpl = "<div> \
<input type='text' ng-model='num' size='80' /> \
<select ng-model='unit'> \
<option value='secs'>Seconds</option> \
<option value='mins'>Minutes</option> \
<option value='hours'>Hours</option> \
<option value='days'>Days</option> \
</select> \
</div>";
@bwiggs
bwiggs / after.js
Last active August 29, 2015 13:57
before and after global namespace pollution cleanup
function findURLValue(q) {
var p = document.location.search.substring(1).split('&'),
i = 0;
for (; i < p.length; i = i + 1) {
if (p[i].split('=')[0] == q) return p[i].split('=')[1];
}
return '';
}
var Application = (function () {