Skip to content

Instantly share code, notes, and snippets.

@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 / pginsert.sql
Created June 3, 2015 18:49
Postgres Insert row with only an auto increment column
INSERT INTO [table] (id) values (default);
<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 / insure.rb
Last active November 11, 2015 20:20
Insurance Company Name Generator
# Example Output
#
# Atlantic Federated states of micronesia Casualty Freedom Services
# Midcontinental Kansas Casualty Holdings Capital
# Coastal Iowa Casualty Specialty Freedom
# Pacific New mexico Fire & marine Freedom Center
# America Ohio Marine Limited Limited
# Midcontinental Connecticut Marine Capital Holdings
# Midwest Citizens Indemnity Assurance Partners
# Midwest Palau Property Corporation Group
@bwiggs
bwiggs / checkmail.py
Last active September 10, 2023 07:27
For use on a raspberry pi. - Checks a gmail account for any unread messages. If there's a message then it turns on a red LED, if there are no emails then it shows a green led.
#!/usr/bin/env python
from imapclient import IMAPClient
import time
import RPi.GPIO as GPIO
DEBUG = True
HOSTNAME = 'imap.gmail.com'
@bwiggs
bwiggs / gist:151a02b50474a7db88ff
Created February 19, 2016 23:02
Find unused directives
#!/usr/bin/env bash
directives=(app-title appetite-toolbar appointment-btn appointment-label appointments-widget auto-focus checklist-filter-group click-to-edit company-card company-list company-logo company-tiles company-typeahead company-typeahead-card compile connection-btn connection-count connections-widget conversation-thread document-click-listener ev-validated-field ev-validated-form evsr-ensure-url expandable-section filter-box guide-member-list iconic industries-selector industry-item industry-sidebar-filter-group inline-login invite-widget line-break-title load-more-button market-appetite-company market-appetite-header market-appetite-product market-appetite-search-form market-appointment-btn market-company market-company-logo market-search-filters market-search-tuning mcglades-search-result member-card member-location member-title member-typeahead member-typeahead-card milestone-nav most-recent-widget navbar-collapse-mobile ng-enter on-finish-render policy-card policy-list product-label product-p

http://codepen.io/anon/pen/zqbpNO?editors=0010

Printing Stuff out

As developers we need to be able to interact with out object and see what's going on inside them. We can use a console.log to get data out of the code we write.

var name = 'brian';
console.log("Hello, ", name);
@bwiggs
bwiggs / .eslintrc
Created June 23, 2016 10:17
JavaScript Standard Style Relaxed
{
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
var pokemonDex = [
'pikachu',
'squirttle',
'bulbasaur'
];
links: [
]
#!/usr/bin/env python
# Dependencies:
# sudo apt-get install -y python-gobject
# sudo apt-get install -y python-smbus
import time
import signal
import dbus
import dbus.service