Skip to content

Instantly share code, notes, and snippets.

View antonagestam's full-sized avatar
🍉

Anton Agestam antonagestam

🍉
View GitHub Profile
@antonagestam
antonagestam / gist:1989563
Created March 6, 2012 22:52
JavaScript: jQuery: Pub/Sub
// Works in modern browsers + IE9, but Modernizr has a polyfill baked in for function.bind.
// Hat tip Paul Irish
(function($){
var o = $( {} );
$.subscribe = o.on.bind(o);
$.unsubscribe = o.off.bind(o);
$.publish = o.trigger.bind(o);
})(jQuery);
@antonagestam
antonagestam / gist:4565712
Last active December 11, 2015 07:19
Shell script that runs `workon project_name` when entering the project directory
function f(){
if [[ $VIRTUAL_ENV != /Users/anton/.virtualenvs/fundedbyme ]];
then
workon fundedbyme
fi
cdvirtualenv
}
function r(){
f
@antonagestam
antonagestam / gist:4586768
Created January 21, 2013 15:18
Remove everyone's emails but admin's
for u in User.objects.all():
if u.email not in ['msn@antonagestam.se','appel268576@gmail.com']:
u.email = '%s@example.com' % u.username
u.save()
@antonagestam
antonagestam / gist:4604297
Created January 23, 2013 10:46
Start development tools
function dev(){
f
sass --watch fundedbyme/static/css/sass:fundedbyme/static/css --style compressed &
rabbitmq-server -detached &
open /Applications/Postgres.app &
}
@antonagestam
antonagestam / settings.py
Last active December 20, 2015 04:59
Django AWS storages
# …
###### AWS SETTINGS
AWS_MEDIA_BUCKET_NAME = AWS_MEDIA_CUSTOM_DOMAIN = 'media.mysite.com'
AWS_STATIC_BUCKET_NAME = AWS_STATIC_CUSTOM_DOMAIN = 'static.mysite.com'
###### END AWS SETTINGS
@antonagestam
antonagestam / Match pattern
Created September 24, 2013 00:31
Replace Django url tags with > 1.5 syntax
\{% url (?!(?:\'|\"))(.*?)( .*?) ?%}
@antonagestam
antonagestam / gist:8176498
Last active January 1, 2016 17:19
Level up
# Move contents of dir to current dir
function level_up(){
temp_name="_$1_temp"
mv $1 $temp_name; mv $temp_name/{,.}* .; rmdir $temp_name;
}
@antonagestam
antonagestam / morning.sh
Last active February 21, 2016 13:38
good morning!
osascript -e 'tell application "Spotify" to activate';
sleep 5;
osascript -e 'tell application "Spotify" to set shuffling to true';
osascript -e 'tell application "Spotify" to play track "spotify:user:bananatrapp:playlist:4a6RQIxSGXZVvXy6ckDeL5"'
@antonagestam
antonagestam / keybase.md
Created December 21, 2016 09:13
keybase.md

Keybase proof

I hereby claim:

  • I am antonagestam on github.
  • I am antonagestam (https://keybase.io/antonagestam) on keybase.
  • I have a public key ASAlMX3lP7UfVfGXWkM1XC13pab0Uy3TSbaDmtfzl0-brgo

To claim this, I am signing this object:

@antonagestam
antonagestam / quicklook
Last active December 22, 2016 09:42
quicklook improvements
from https://twitter.com/Viss/status/809168960495063040
$ brew install Caskroom/cask/qlstephen
$ defaults write com.apple.finder QLEnableTextSelection -bool TRUE
$ killall Finder
$ brew install Caskroom/cask/qlcolorcode
$ qlmanage -r