Skip to content

Instantly share code, notes, and snippets.

View brock's full-sized avatar
😎

Brock Angelo brock

😎
View GitHub Profile
@brock
brock / groot.sh
Created July 17, 2014 20:37
GROOT - go to the "git root"
#!/bin/bash
# GROOT! v 1.0.0
# Install in your dotfiles, .bashrc, .zshrc or similar
# No more cd ../../../../.. to get to the root of a git project
# Running the command "groot" will look for the closest .git directory and take you there.
# Note that it doesn't traverse up the tree, it takes you directly to the directory with a .git in it...
# ...so the command `cd -` takes you back to where you were.
# Works with *some* submodules (depending on how your submodule was setup - as a file or a dir)
# If you are using submodules, you should be able to figure out how to modify this.
@brock
brock / gbs.sh
Created June 19, 2014 21:11
gbs - git branch sorted (by date)
gbs () {
for k in `git branch | perl -pe 's/^..(.*?)( ->.*)?$/\1/'`
do
echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k -- | head -n 1`\\t$k
done | sort -r | awk '{ print $4, $5, $6, $7}' | head -n 10
}
<?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>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.19370138645172119</real>
<key>Green Component</key>
<real>0.15575926005840302</real>
@brock
brock / gs.sh
Last active August 29, 2015 14:01
Name git stashes
function gs() {
BRANCH=$(git branch | grep "*" | sed 's/^\* //')
TODAY=$(date +"%Y%m%d-%H%M%S")
git stash save $TODAY-$BRANCH
}
L.Control.Button = L.Control.extend({
options: {
position: 'bottomleft'
},
initialize: function (options) {
this._button = {};
this.setButton(options);
},
@brock
brock / webinar.md
Last active August 29, 2015 14:00
a crazy good webinar on using webstorm. these are notes to accompany the recorded session that will be published the week of Mon, April 28th

WebStorm AngularJS Webinar

AngularJS

  1. Install angular with: terminal: bower install angular
  2. Ctrl-space twice
  3. ng stuff works now
  4. Preferences: Editor: angularjs add whitespace
  5. Debug (there is a shortcut so you can do live edit and it updates in chrome)
  6. You can change your code style for html. Preferences: Code Style: HTML (worth a look through these settings)
  7. Cmd+Alt+L to reformat your code

A Backbone.js demo app (Sinatra Backend)

Oct 16 2010

Updates

  • 04/10/2011 - Updated application.js and application.rb thanks to @rebo's comments

In this article, I will walk through some simple steps to get a [demo app][2] up and running with [Backbone.js][3] and [Sinatra][4] on [Heroku][5].

import praw # simple interface to the reddit API, also handles rate limiting of requests
import re
from collections import deque
from time import sleep
USERNAME = "Your username here"
PASSWORD = "Your password here"
USERAGENT = "Your useragent string here. It should include your /u/username as a courtesy to reddit"
r = praw.Reddit(USERAGENT)
@brock
brock / 0_reuse_code.js
Created October 29, 2013 19:07
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
@brock
brock / boom.html
Created September 28, 2013 21:37
Lazy Load images for Boom GUI. Asked on StackOverflow, solution here: https://gist.github.com/brock/6724161
<!DOCTYPE HTML>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js" charset="utf-8"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.min.js"></script>
<script src="//cdn.jsdelivr.net/jquery.lazyload/1.9.0/jquery.lazyload.min.js"></script>
<script type="text/javascript">
angular.module('boomApp', [])
.controller('BoomCtrl', function ($scope, $http) {
$http.get(".boom")