Skip to content

Instantly share code, notes, and snippets.

@jeroenbourgois
jeroenbourgois / nginx-main-conf
Created February 26, 2011 18:20
nginx-main-conf
worker_processes 1;
# pid of nginx master process
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
@jeroenbourgois
jeroenbourgois / nginx-dev.local
Created February 26, 2011 18:23
nginx-site-conf
server {
listen 80;
server_name dropbox.local;
root /Users/Jeroen/Dropbox/development/online;
autoindex on;
location / {
index index.html index.php;
@fredgrott
fredgrott / eclipse-checkstyle-android-best-practices
Created April 29, 2011 14:57
eclipse checkstyle checks for android
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<!--
Checkstyle-Configuration: Android checkstyle by Enea
Description: none
-->
@proofek
proofek / pre-receive
Created June 2, 2011 14:21
pre-receive git hook to run php linter
#!/usr/bin/php
<?php
echo "\nRunning php linter...\n";
$params = explode(' ', file_get_contents('php://stdin'));
$ref = trim($params[1]);
$diff = array();
$return = 0;
@jk
jk / check-php-syntax-errors.sh
Created July 13, 2011 15:50
Check directories for PHP syntax errors
find . -name "*.php" -exec php -l {} \; | grep "PHP Parse error:"
@blakewatters
blakewatters / gist:1114150
Created July 29, 2011 16:18
Attach an Image to an Object Loader
[[RKObjectManager sharedManager] postObject:contact delegate:self block:^(RKObjectLoader* loader) {
RKObjectMapping* serializationMapping = [[[RKObjectManager sharedManager] mappingProvider] serializationMappingForClass:[Contact class]];
NSError* error = nil;
NSDictionary* dictionary = [[RKObjectSerializer serializerWithObject:contact mapping:serializationMapping] serializedObject:&error];
RKParams* params = [RKParams paramsWithDictionary:dictionary];
[params setData:[contact avatarImageData] MIMEType:@"image/png" forParam:@"avatar_image"];
loader.params = params;
}];
@coldnebo
coldnebo / Default (Linux).sublime-keymap
Created August 10, 2011 23:20
simple scripts to prettify your xml and json in sublime text 2
[
{ "keys": ["ctrl+shift+x"], "command": "tidy_xml" },
{ "keys": ["ctrl+shift+j"], "command": "prettify_json" }
]
@jk
jk / PHP+RestServer.language
Created August 16, 2011 13:34
Extended TextMate PHP language for supporting RestServer.php notation
{ scopeName = 'source.php';
comment = "TODO:
• Try to improve parameters list syntax – scope numbers, ‘=’, ‘,’ and possibly be intelligent about entity ordering
• Is meta.function-call the correct scope? I've added it to my theme but by default it's not highlighted";
firstLineMatch = '^#!.*(?<!-)php[0-9]{0,1}\b';
foldingStartMarker = '(/\*|\{\s*$|<<<HTML)';
foldingStopMarker = '(\*/|^\s*\}|^HTML;)';
patterns = (
{ comment = 'Matches empty tags.';
match = '(?x)
@monkeydom
monkeydom / CompareMacro.h
Created August 24, 2011 10:33
Objective-C Compare Macro for your convenience
#if !defined(COMPARE)
#define COMPARE(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? NSOrderedAscending : (__a > __b ? NSOrderedDescending : NSOrderedSame); })
#endif
@javan
javan / gist:1168475
Created August 24, 2011 16:32
Fix iPhone home button
Found this tip in comment here: http://www.tipb.com/2011/01/04/tipb-bug-home-button-working-iphone/
1.) Open any application
2.) Press and hold the power button until the slide to shutdown swipe bar appears.
3.) Release Power button
4.) Press and hold Home button Lightly
until screen returns to icon screen