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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActionDispatch::Routing::Mapper | |
def draw(routes_name) | |
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb"))) | |
end | |
end | |
BCX::Application.routes.draw do | |
draw :api | |
draw :account | |
draw :session |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'securerandom' | |
class NameGenerator | |
LEFT = [ | |
"admiring", | |
"adoring", | |
"affectionate", | |
"agitated", | |
"amazing", | |
"angry", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 | |
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU' | |
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU' | |
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag] | |
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a port of the javascript code found in the following link | |
#http://groups.google.com/group/Google-Maps-API/browse_thread/thread/a45947d72c27cc73 | |
class Mercator | |
#offset is defined at zoom level 21 which means that this Mercator is valid for 21 zoom levels | |
OFFSET = 268435456 | |
RADIUS = OFFSET / Math::PI | |
def self.lng_to_x(lng, zoom) | |
(OFFSET + RADIUS * lng * Math::PI / 180).to_i >> (21 - zoom) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// UIImageJPEGRepresentation | |
NSData *data = UIImageJPEGRepresentation(tileImage, 0.71); | |
[data writeToURL:cacheURL atomically:YES]; | |
// ImageIO | |
#import <ImageIO/ImageIO.h> | |
#import <MobileCoreServices/UTCoreTypes.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_actionDelayTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:[NSBlockOperation blockOperationWithBlock:^{ | |
NSLog(@"Well this is useless."); | |
}] selector:@selector(start) userInfo:nil repeats:YES]; |
NewerOlder