Skip to content

Instantly share code, notes, and snippets.

View bjonord's full-sized avatar

Björn Nordstrand bjonord

View GitHub Profile
@bjonord
bjonord / loginWithUsername Obj-C version
Created September 16, 2012 11:09
This is a "snippet" of a MKNetworkKit method in Objective-C and RubyMotion
// How to use..!
[MyNetworkClass loginWithUsername:self.username.text
password:self.password.text
responseBlock:^(NSDictionary* jsonDict, NSError* error) {
if([[jsonDict objectForKey:@"result"] boolValue]){
// Logged in!
}
}
];
@bjonord
bjonord / tipsntricks_sublime.md
Created November 21, 2012 21:33
Tips and Tricks gathered from the Nettuts+ Sublime Text 2 tutorial

Keyboard shortcuts:

(super = command in OS X and windows button in Windows/Linux)

  • ctrl + super + g - after selecting a text this command will select every appearance of the same string throughout the document.
  • super + i - Incremental search
  • shift + super + p - Command Palette (essentially find anything)

Configurations:

  • VI mode - Remove vintage mode from "ignored_packages" inside settings file, make sure to change the user settings not default.
  • You can filter what your project file displays, by making changes to the .sublime-project, here you are able to set specific paths to include, or what files to exclude/include.

NOTE TO CONTRIBUTORS : Take this wherever you like. If you have articles that really helped you, add them to the list of resources at the end. All content added to this Gist is considered public domain. Add your name to the list of contributors at the end if you want attribution.

Suggestions on where to eventually take this content are welcome. I was thinking of making it into a Github pages branch, or maybe on a wiki somewhere?

Testing Chef Cookbooks : A Landscape

There seem to be many approaches to test driving your Chef infrastructure, and the amount of projects to pick from is overwhelming. This document tries to provide some overview and be a guide to the world of Chef

@bjonord
bjonord / xps13_crunchbang.markdown
Last active December 21, 2015 05:59
Getting a Dell XPS 13 up and running with Crunchbang(Waldorf), Linux Kernel 3.10.6(or the Ubuntu Sputnik kernel) and Ruby on Rails

Getting a Dell XPS 13 up and running with Crunchbang(Waldorf), Linux Kernel 3.10.6(or the Ubuntu Sputnik kernel) and Ruby on Rails

Update 04/09-2013:

Well the sputnik kernel might have better support for the web camera and some other minor things, but all of a sudden it started crashing over and over again and I was not able to track down the reason. Back on kernel 3.10.6 and it has been running fine since, will keep this gist updated as things progress.

End of updates

I'm currently employed as a Backend developer for an e-commerce company and I received a new laptop to work on, which is a Dell XPS 13. While this laptop comes in a Ubuntu version, the one I received at work was not that model but a core I5 with Win8P.

@bjonord
bjonord / target_urls.txt
Last active December 25, 2015 01:09
Wikiscraper for the geo-tag at each url. Horrible code, first attempt at using Node.js.
China;http://en.wikipedia.org/wiki/China
Philippines;http://en.wikipedia.org/wiki/Philippines
Sweden;http://en.wikipedia.org/wiki/Sweden
Italy;http://en.wikipedia.org/wiki/Italy
Brazil;http://en.wikipedia.org/wiki/Brazil
@bjonord
bjonord / shell_commands.sh
Last active December 25, 2015 01:59
Nifty terminal stuff
#Find a specific string inside a folder of files -
find . -name "*.gz" -exec zgrep --color -nH "Pattern" \{\} \; # case sensitive
find . -name "*.gz" -exec zgrep --color -iHn "Pattern" \{\} \; # case insensitive
# General grep command -
grep --color -nrH "tretti" ./*
@bjonord
bjonord / e-ctags.sh
Last active December 25, 2015 15:09
exuberant-ctags emacs
#!/usr/bin/env zsh
# Make sure you have exuberant-ctags installed.
sudo apt-get install exuberant-ctags
# Generate ctags for the project you are in. For use in Emacs
ctags -e -R --exclude=.git --exclude=log --languages=Ruby .
# Now you should be able to access the tags via M-. inside emacs.
@bjonord
bjonord / CreateExtensionsForDb.rb
Created November 2, 2013 11:54
earth_box in ActiveRecord
# Migration to add cube and earthdistance extensions.
class CreatePostgresExtensions < ActiveRecord::Migration
def up
ActiveRecord::Base.connection.execute("CREATE EXTENSION cube;")
ActiveRecord::Base.connection.execute("CREATE EXTENSION earthdistance;")
end
def down
ActiveRecord::Base.connection.execute("DROP EXTENSION earthdistance;")
ActiveRecord::Base.connection.execute("DROP EXTENSION cube;")
@bjonord
bjonord / timezone_change.sh
Created December 29, 2013 10:59
change timezone ubuntu
#!/usr/bin/env bash
sudo dpkg-reconfigure tzdata
@bjonord
bjonord / resque_initd.sh
Last active January 3, 2016 05:09
init.d and monitrc file for resque-pool - https://github.com/nevans/resque-pool
#!/bin/sh -e
APP_NAME="xxxx"
APP_DIR="/var/www/${APP_NAME}/current"
PIDFILE="${APP_DIR}/tmp/pids/${APP_NAME}_resque"
RUN_AS="rails"
SLEEP_TIME=5
ENV="production"
STDOUT="${APP_DIR}/log/resque-pool.log"
STDERR="${APP_DIR}/log/resque-pool-error.log"