Skip to content

Instantly share code, notes, and snippets.

@grassdog
grassdog / .gitconfig
Created April 23, 2020 07:09
Git aliases
[alias]
unstage = reset HEAD
# What's changed since last pull
news = log -p HEAD@{1}..HEAD@{0}
# Mark a repo as trusted
trust = "!mkdir -p .git/safe"
# List commits
@grassdog
grassdog / MultiSelect.elm
Last active October 14, 2016 02:11
An attempt to extract the selected values of a multi select in Elm
module Main exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.App as Html
import Html.Events exposing (onInput, on, targetValue)
import Json.Decode as Json
import String exposing (join)

Keybase proof

I hereby claim:

  • I am grassdog on github.
  • I am grassdog (https://keybase.io/grassdog) on keybase.
  • I have a public key whose fingerprint is 7631 9C8E 27B4 6E57 10FD 6E84 6BDE 5281 5648 940B

To claim this, I am signing this object:

@grassdog
grassdog / karma.config.js
Last active August 29, 2015 14:23
Example karma config for running jasmine tests that uses webpack to support jsx.
/**
* This is the Karma configuration file. It contains information about this skeleton
* that provides the test runner with instructions on how to run the tests and
* generate the code coverage report.
*
* For more info, see: http://karma-runner.github.io/0.12/config/configuration-file.html
*/
module.exports = function(config) {
config.set({
--langdef=coffee
--langmap=coffee:.coffee
--regex-coffee=/(^|=[ \t])*class ([A-Za-z]+\.)*([A-Za-z]+)( extends [A-Za-z.]+)?$/\3/c,class/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?@?([A-Za-z.]+):.*[-=]>.*$/\3/m,method/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?([A-Za-z.]+)[ \t]+=.*[-=]>.*$/\3/f,function/
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=[^->\n]*$/\1/v,variable/
--regex-coffee=/^[ \t]*@([A-Za-z.]+)[ \t]+=[^->\n]*$/\1/f,field/
--regex-coffee=/^[ \t]*@([A-Za-z.]+):[^->\n]*$/\1/f,static field/
--regex-coffee=/^[ \t]*([A-Za-z.]+):[^->\n]*$/\1/f,field/
--regex-coffee=/(constructor: \()@([A-Za-z.]+)/\2/f,field/
@grassdog
grassdog / goals.rb
Created December 12, 2012 13:37
An example of a JSON presenter. It uses the Representative gem for JSON rendering.
class Goal < ActiveRecord::Base
belongs_to :user
has_many :checkpoints
# Fields from schema.rb
#create_table "goals", :force => true do |t|
# t.string "description"
# t.string "period"
# t.integer "user_id"
# t.integer "position"
@grassdog
grassdog / download-and-run.ps1
Created July 23, 2012 03:23
Script for downloading a Powerhell script via a proxy and executing it
param (
[Parameter(Mandatory=$true, HelpMessage='Provide a URL to download')]
$url
)
$proxy = new-object System.Net.WebProxy("http://myproxyaddress")
$username = 'myusername'
$password = ConvertTo-SecureString 'MyPass' -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential $username, $password
$proxy.credentials = $cred
@grassdog
grassdog / band_names.md
Last active October 6, 2015 19:58
List of bands represented by Vanderhuge Industries A&R division.
  • Stingray Tetanus
  • This side towards enemy
  • Restrictive Clause is Parenthetical
  • Wolfman Strauss and the Pestilence
  • Above the Popcorn
  • Sherpa Support Cr3w
  • Suddenly Flatulent
  • Finger Smash Scream Time
@grassdog
grassdog / Stellar.tmTheme
Created January 16, 2012 08:37
My fork of the dark Solarized theme for textmate
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Stellar</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@grassdog
grassdog / git-notpushed.sh
Created August 18, 2011 00:27
Script to show which commits aren't pushed to a remote
#!/bin/sh
#
# Shows commits you haven't pushed to the remote yet. Accepts same
# arguments as git-log. Assumes 'origin' is the default remote if no
# branch.Foo.remote configuration exists.
curr_branch=$(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||')
origin=$(git config --get "branch.$curr_branch.remote")
origin=${origin:-origin}