Skip to content

Instantly share code, notes, and snippets.


William Denniss WilliamDenniss

View GitHub Profile
View name_generator.rb
require 'securerandom'
class NameGenerator
LEFT = [
peterdalle / robots.txt
Created Dec 3, 2016
Robots.txt that makes sure Facebook and Twitter can crawl images on your site.
View robots.txt
# Disallow everything.
User-agent: *
Disallow: /
# Certain social media sites are whitelisted to allow crawlers to access page markup when links to /images are shared.
User-agent: Twitterbot
Allow: /images
User-agent: facebookexternalhit
Allow: /images
View screen_cheatsheet.markdown

Screen Quick Reference


Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r
MartinMoizard / gist:6537467
Created Sep 12, 2013
Category on UIViewController: recursive function to present a modal View Controller anywhere in the application. Example: [self.window.rootViewController presentViewControllerFromVisibleViewController:myViewController]; Works with application using only UINavigationController and modal views. Can be enhanced to handle UITabBarController or other…
View gist:6537467
- (void)presentViewControllerFromVisibleViewController:(UIViewController *)viewControllerToPresent
if ([self isKindOfClass:[UINavigationController class]]) {
UINavigationController *navController = (UINavigationController *)self;
[navController.topViewController presentViewControllerFromVisibleViewController:viewControllerToPresent];
} else if (self.presentedViewController) {
[self.presentedViewController presentViewControllerFromVisibleViewController:viewControllerToPresent];
} else {
[self presentModalViewController:viewControllerToPresent animated:YES];
davbeck / gist:3661211
Created Sep 6, 2012
NSTimer with block
View gist:3661211
_actionDelayTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:[NSBlockOperation blockOperationWithBlock:^{
NSLog(@"Well this is useless.");
}] selector:@selector(start) userInfo:nil repeats:YES];
View gist:2492118
class ActionDispatch::Routing::Mapper
def draw(routes_name)
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
odrobnik / gist:1845108
Created Feb 16, 2012
ImageIO versus UIImageJPEGRepresentation
View gist:1845108
// UIImageJPEGRepresentation
NSData *data = UIImageJPEGRepresentation(tileImage, 0.71);
[data writeToURL:cacheURL atomically:YES];
// ImageIO
#import <ImageIO/ImageIO.h>
#import <MobileCoreServices/UTCoreTypes.h>
View gist:1101862
// say that the object which is our _delegate is the only object retaining us
// and it calls this -processStuff method…
- (void)processStuff
// and then this happens:
[_delegate finishedSomething:self];
// now, in _delegate's -finishedSomething: it ends up releasing us like so:
View sass_and_less_compared.markdown

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.


njvitto / deploy.rake
Created Apr 11, 2010 — forked from RSpace/deploy.rake
Rakefile to deploy and rollback to Heroku in two different environments (staging and production) for the same app
View deploy.rake
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]