Skip to content

Instantly share code, notes, and snippets.

View samanthamjohn's full-sized avatar

Samantha samanthamjohn

View GitHub Profile
@samanthamjohn
samanthamjohn / command_line_output
Created June 19, 2013 16:08
Output of rails console on heroku
~/Development/gethopscotch:master$ heroku run rails c -a get-hopscotch
Running `rails c` attached to terminal... up, run.1164
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /app/vendor/ruby-2.0.0/bin/ruby
-m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
[--skip-gemfile] # Don't create a Gemfile
@samanthamjohn
samanthamjohn / Gemfile
Last active December 15, 2015 07:59
How to set up the asset pipeline for rails 4.
group :assets do
gem 'sass-rails', '~> 4.0.0.beta1'
gem 'coffee-rails', '~> 4.0.0.beta1'
gem 'sprockets-rails', :require => 'sprockets/railtie'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'uglifier', '>= 1.0.3'
end
@samanthamjohn
samanthamjohn / gist:4400186
Last active December 10, 2015 07:18
Hopscotch Meta tags
<meta content="summary" name="twitter:card" />
<meta content="http://blog.gethopscotch.com" name="twitter:url" />
{block:PermalinkPage}
<meta content="{Permalink}" name="twitter:url" />
{/block:PermalinkPage}
<meta content="{Title}" name="twitter:title" />
{block:PostSummary}
<meta content="{PostSummary}" name="twitter:title" />
@samanthamjohn
samanthamjohn / StageViewController.m
Created September 6, 2012 23:14
Original StageViewController
-(void) viewDidLoad
{
[[CCDirector sharedDirector] setAnimationInterval:1.f/60.f];
[[CCDirector sharedDirector] setView:stageView];
CCScene *scene = [StageLayer scene];
}
@samanthamjohn
samanthamjohn / SliderViewController
Created September 6, 2012 23:08
Cocos2d with UIKit
- (void)revealToggle:(id)sender
{
self.sliderShown ? [self concealAnimation] : [self revealAnimationWithCallback:^(void){}];
}
- (void)revealAnimationWithCallback:(void (^) (void) )callback
{
[self.backgroundView addSubview:self.overlayView];
NSTimeInterval duration = self.toggleAnimationDuration;
[UIView animateWithDuration:duration delay:0.0f options:UIViewAnimationOptionBeginFromCurrentState|UIViewAnimationOptionAllowUserInteraction animations:^
@samanthamjohn
samanthamjohn / Rakefile
Created March 6, 2012 07:27
Rakefile to run both jasmine and specs.
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
task :default => ['spec', 'jasmine:ci']
Hopscotch::Application.load_tasks
@samanthamjohn
samanthamjohn / README.md
Created February 17, 2012 14:42
Configuring the an automatic sprite generator with the Rails 3.1 asset pipeline

This is a useful shortcut to getting up and running with the excellent but slightly out-of-date Sprite Gem from gistinc https://github.com/gistinc/sprite.

Your file tree should look something like:

app/assets/images/sprites/{name_of_sprite_folder}/{source_png_images}

Running

rake sprite
find . -name '*erb' | \
xargs ruby -e 'ARGV.each { |i| puts "html2haml -r #{i} #{i.sub(/erb$/,"haml")}"}' | \
bash
find . -name '*erb' | \
xargs ruby -e 'ARGV.each { |i| puts "rm #{i}"}' | \
bash
@samanthamjohn
samanthamjohn / domain_names.rb
Created March 4, 2011 18:09
A script to generate potential domain names.
#! /usr/bin/env ruby
root_word = ARGV[0] || ''
word_size = ARGV[1].to_i
word_size = 3 if word_size == 0
domain_names = []
dictionary = File.read('/usr/share/dict/words').split("\n").select{|d| d.size == word_size}
dictionary.each do |word|
domain_names.push("#{word}#{root_word}.com")
end
system("touch #{root_word}.txt")
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"