Skip to content

Instantly share code, notes, and snippets.

View LFabien's full-sized avatar
🎯
Focusing

Fabien LFabien

🎯
Focusing
View GitHub Profile
Flying Lotus - Lit Up (Instrumental)
Phaseone - Cadence + Athena
Gary Numan - Films
Hovatron - Gypsy Trader
The Field - The More That I Do (Foals remix)
Surfs - Tu Seras Mi Baby
The Very Best - Cape Cod Kwassa Kwassa
Orchestre N'guewel - Mi Guajeo
Harvard Bass - 81 (Renaissanceman remix)
Znobia - Tchilo (Diplo remix)
@mystix
mystix / .aliases
Created September 27, 2010 19:11
OSX dot config files
# ls shortcuts
alias ls='ls -G'
alias ll='ls -Flh'
# git shortcuts
function git_discard {
# note: only works in zsh shell
echo "Discard all changes? "
read -q REPLY
module MockSnowflake
TWEPOCH = 1142974214000
WORKERIDBITS = 5
DATACENTERIDBITS = 5
MAXWORKERID = -1 ^ (-1 << WORKERIDBITS)
SEQUENCEBITS = 12
WORKERIDSHIFT = SEQUENCEBITS
DATACENTERIDSHIFT = SEQUENCEBITS + WORKERIDBITS
TIMESTAMPLEFTSHIFT = SEQUENCEBITS + WORKERIDBITS + DATACENTERIDBITS
@idoru
idoru / XCode_SwapBetweenSpec.scpt
Created November 17, 2010 05:36
[Not compatible with XCode 4] Ever wanted to switch between Cedar specs and your implementation with a single keystroke? Well, there's a user script for that!
(*
SwapBetweenSpec.scpt
Get into the BDD groove with this Xcode user script which quickly toggles between your implementation (or header)
and its Cedar Spec. Bind it to your favorite shortcut key and enjoy the cycle.
Be sure to add this User Script to Xcode as an Applescript, not a shell script:
1. Paste the contents of the gist into ~/Library/Application Support/Developer/Shared/Xcode/User Scripts/SwapBetweenSpec.scpt
2. When adding to script in the "Edit User Scripts" window of Xcode, choose "Add Script File..." and not "New Shell Script" and then choose the file from (1)
3. Set Input to "No Input"

Objective-C Coding Convention and Best Practices

Most of these guidelines are to match Apple's documentation and community-accepted best practices. Some are derived some personal preference. This document aims to set a standard way of doing things so everyone can do things the same way. If there is something you are not particularly fond of, it is encouraged to do it anyway to be consistent with everyone else.

This document is mainly targeted toward iOS development, but definitely applies to Mac as well.

Operators

NSString *foo = @"bar";
@0xc010d
0xc010d / ReCodeSign
Created November 14, 2011 22:38
Codesign an iOS app, with a different distribution certificate and mobileprovisioning file.
- Copy the delivered ipa into a directory to work in.
- export PlistBuddy="/usr/libexec/PlistBuddy" to get the PlistBuddy tool to your shell. If it is not added, all references to PlistBuddy
will need to be written as the full path.
- Take the delivered App.ipa and unzip it using the unzip command. This should produce a Payload directory containing the app and its
resources.
- Enter the command "codesign -d --entitlements :enterprise.plist Payload/PathToApp.app/" This pulls the entitlements out of the app, and
prints them to a plist, without a leading "blob" of data. Pay particular attention to the colon before the enterprise.plist file name.
@chriseidhof
chriseidhof / nsincrementalstore.markdown
Created February 18, 2012 16:39
Accessing an API using CoreData's NSIncrementalStore

Accessing an API using CoreData's NSIncrementalStore

Note: the original location of this article is on my blog, however, it is posted here too for better readability.

In this article, we will see how to use Core Data for accessing your API. We will use the Bandcamp API as our running example. I've only been experimenting with this code for a few days, so there might be mistakes in there.

@sdhull
sdhull / pre-commit
Created April 17, 2012 23:36
.git/hooks/pre-commit
#!/usr/bin/env ruby
file_names = `git diff-index --cached -Sdebugger --name-only HEAD`
file_names += `git diff-index --cached -Ssave_and_open_page --name-only HEAD`
file_names = file_names.strip
if file_names != ""
puts "The following files have 'debugger' or 'save_and_open_page' statements in them: "
puts file_names
raise "Please complete your merge prior to committing" unless ENV["FORCE"]
end
#!/bin/sh
ORIGINALDIR="$( pwd )"
SCRIPTDIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BASEDIR="$( cd -P $SCRIPTDIR/.. && pwd )"
COLORON='printf "`tput setaf 7`"'
COLORON2='printf "`tput setaf 5`"'
COLORONRED='printf "`tput setaf 1`"'
COLOROFF='printf "`tput sgr0`"'
@WeptunUser
WeptunUser / floatsign.sh
Last active January 1, 2022 21:23 — forked from mediabounds/floatsign.sh
Now fix when no entitlements are present.
# !/bin/bash
# Copyright (c) 2011 Float Mobile Learning
# http://www.floatlearning.com/
# Extension Copyright (c) 2013 Weptun Gmbh
# http://www.weptun.de
#
# Extended by Ronan O Ciosoig January 2012
#
# Extended by Patrick Blitz, April 2013