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 / install_rmagick.sh
Last active August 29, 2015 14:16
Install RMagick linked to some specific ImageMagick version
sudo C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.9.0-10/include/ImageMagick-6/wand/ PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.9.0-10/lib/pkgconfig/ gem install rmagick
@toashd
toashd / gist:ee105034c763a65c5534
Created January 29, 2015 11:07
Go check if file exists
// Exists reports whether the named file or directory exists.
func Exists(name string) bool {
if _, err := os.Stat(name); err != nil {
if os.IsNotExist(err) {
return false
}
}
return true
}
package main
import (
"bytes"
"fmt"
)
func main() {
var buffer bytes.Buffer
import (
"fmt";
"strings";
)
func main() {
s := []string{"this", "is", "a", "joined", "string\n"};
fmt.Printf(strings.Join(s, " "));
}
@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
@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: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 / 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 / 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 / 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");
});
});