Skip to content

Instantly share code, notes, and snippets.

View toashd's full-sized avatar
🧃

Tobias Schmid toashd

🧃
  • Munich · Berlin
View GitHub Profile
@toashd
toashd / remote_debug.rb
Created March 27, 2013 12:35
Enable remote debugging of rails apps running on POW
POW_ENABLED = false
if POW_ENABLED && Rails.env.development? && !$rails_rake_task
Debugger.settings[:autoeval] = true
Debugger.settings[:autolist] = 1
Debugger.settings[:reload_source_on_change] = true
Debugger.start_remote
end
@toashd
toashd / gist:5728890
Created June 7, 2013 12:27
"A server is already running" kill pid file
$ lsof -wni tcp:3000
$ kill -9 PID
@toashd
toashd / git_loc
Last active December 30, 2015 14:09
Git lines of code
git ls-files | xargs cat | wc -l
@toashd
toashd / gcd_example.m
Last active December 30, 2015 16:38
Multithreading and Grand Central Dispatch on iOS (most simple example)
-(void) viewDidLoad {
[super viewDidLoad];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//Here your non-main thread.
NSLog (@"Hi, I'm new thread");
dispatch_async(dispatch_get_main_queue(), ^{
//Here you returns to main thread.
NSLog (@"Hi, I'm main thread");
});
});
@toashd
toashd / objC-bracket-style
Created February 19, 2014 14:09
Put opening brackets on the same line as declarations.
defaults write com.apple.Xcode XCCodeSenseFormattingOptions '{ "BlockSeparator" = "" ; }'
@toashd
toashd / gist:10733353
Created April 15, 2014 13:37
xVim installation with XCode 5.1
1. Remove xVim: rm -rf ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/XVim.xcplugin
2. Checkout the develop branch: git checkout develop
3. Open the xVim project
4. Ignore message about GC not being supported. Don't convert to Arc.
5. Select XCode 5 as your build target.
6. Set it to Release.
7. Build
@toashd
toashd / gist:4e8a9468ef783455d9ed
Created December 16, 2014 16:29
Install ImageMagick with Ruby 2.1.5
brew update && brew upgrade
brew uninstall -all pkgconfig imagemagick
brew install pkgconfig imagemagick
mdfind MagickWand.h
mdfind MagickCore.pc
sudo C_INCLUDE_PATH=<path to wand dir> PKG_CONFIG_PATH=<path to core dir> gem install imagemagick
@toashd
toashd / commit_date_now
Created December 17, 2014 10:52
Change git commit date to current
GIT_COMMITTER_DATE="`date`" git commit --amend --date "`date`"
@toashd
toashd / gist:87fd1b0b812563b9b2f2
Created December 17, 2014 10:54
Update github forked repository
# Add the remote, call it "upstream":
git remote add upstream https://github.com/whoever/whatever.git
# Fetch all the branches of that remote into remote-tracking branches,
# such as upstream/master:
git fetch upstream
# Make sure that you're on your master branch:
git checkout master
import (
"fmt";
"strings";
)
func main() {
s := []string{"this", "is", "a", "joined", "string\n"};
fmt.Printf(strings.Join(s, " "));
}