Skip to content

Instantly share code, notes, and snippets.

View benschw's full-sized avatar

Ben Schwartz benschw

View GitHub Profile
@benschw
benschw / record-ip.sh
Created May 9, 2013 23:36
get current public ip from whatismyip.com's service
#!/bin/sh
/usr/bin/curl www.whatismyip.com/automation/n09230945.asp
@benschw
benschw / wikipedia-cli.sh
Created May 9, 2013 23:35
wikipedia cli shell script
#!/bin/sh
dig +short txt ${1}.wp.dg.cx
@benschw
benschw / gist:5551410
Created May 9, 2013 23:31
clear out terminal logs with os x terminals start loading slow
/private/var/log/asl/*.asl
@benschw
benschw / gist:5551403
Created May 9, 2013 23:30
os x software list
  • Firefox 3.5.dmg
  • Adium_1.3.5.dmg
  • charles_macosx.zip
  • Dropbox 0.6.507.dmg
  • Growl-1.1.5.dmg
  • iTerm_0.9.6.dmg
  • KeePassX-0.4.0.dmg
  • MacCallGrind 1.0b3.app/
  • MacPorts-1.7.1-10.5-Leopard.dmg
  • MissingDrawer_2009-01-27.zip.zip
@benschw
benschw / gist:5551397
Last active December 17, 2015 04:38
openbox on debian wheezy

debian openbox install notes

[log in]
$ su
# aptitude install sudo
# adduser ben sudo
# exit
$ exit
[log in]
$ sudo aptitude install menu openbox obconf xinit
@benschw
benschw / gist:5551387
Created May 9, 2013 23:27
runt virtualbox vm headless with ssh@2222
~$ VBoxManage modifyvm "ubuntu-vm" --natpf1 "guestssh,tcp,127.0.0.1,2222,,22"
~$ VBoxHeadless -s ubuntu-vm
@benschw
benschw / gist:5518413
Created May 4, 2013 19:07
Target views relatively or absolutely with AngularJS ui-router
$stateProvider
.state('contacts.detail', {
views: {
// relatively targets the "info" view in "contacts.detail" state:
"info" : { /* ... */ }
// relatively targets the unnamed view in "contacts.detail" state:
"" : { /* ... */ }
// absolutely targets the "detail" view in parent "contacts" state:
"detail@contacts" : { /* ... */ }
// absolutely targets the unnamed view in parent "contacts" state:
@benschw
benschw / gist:5518392
Last active December 17, 2015 00:09
$stateParams Service and GET parameters
// If you had a url on your state of:
url: '/users/:id/details/{type}/{repeat:[0-9]+}?from&to'
// Then you navigated your browser to:
'/users/123/details//0'
// Your $stateParams object would be
{ id:'123', type:'', repeat:'0' }
// Then you navigated your browser to:
@benschw
benschw / gist:5518277
Last active December 17, 2015 00:09
private package with bower
{
"name": "myproject",
"version": "1.0.0",
"dependencies": {
"jquery": "1.8.0",
"twitter/bootstrap": "2.1.1",
"myrepo":"git://myrepo.com/myrepo"
}
}
@benschw
benschw / gist:5516156
Last active December 16, 2015 23:49
AngularJS Breadcrumbs Service
// https://github.com/angular-app/angular-app
angular.module('services.breadcrumbs', []);
angular.module('services.breadcrumbs').factory('breadcrumbs', ['$rootScope', '$location', function($rootScope, $location){
var breadcrumbs = [];
var breadcrumbsService = {};
//we want to update breadcrumbs only when a route is actually changed
//as $location.path() will get updated imediatelly (even if route change fails!)