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
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
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
How to setup Heroku Hostname SSL with GoDaddy SSL Certificate and Zerigo DNS | |
Heroku recently added an exciting new 'Hostname SSL' option. This option offers the broad compatibility of IP-based SSL, but at 1/5 the price ($20 / month at the time of this writing). | |
The following tutorial explains how to use Heroku's new 'Hostname SSL' option on your Heroku project. Before we begin, let's list what we're using here: | |
* Heroku Hostname SSL | |
* GoDaddy Standard SSL Certificate | |
* Zerigo DNS |
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
# Sample implementation of quicksort and mergesort in ruby | |
# Both algorithm sort in O(n * lg(n)) time | |
# Quicksort works inplace, where mergesort works in a new array | |
def quicksort(array, from=0, to=nil) | |
if to == nil | |
# Sort the whole array, by default | |
to = array.count - 1 | |
end |
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
These are some needed bundles for TM2... | |
cd ~/Library/Application Support/Avian/Bundles | |
git clone https://github.com/cucumber/cucumber-tmbundle Cucumber.tmbundle | |
git clone https://github.com/kuroir/SCSS.tmbundle | |
git clone https://github.com/mads379/Whitespace.tmbundle | |
open Cucumber.tmbundle/color_themes/Sunburst.tmTheme |
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
# add something like this to config.ru | |
# see https://github.com/kzk/unicorn-worker-killer | |
if Integer(ENV['UNICORN_KILLER'] || 0) != 0 | |
require 'unicorn/worker_killer' | |
# Max memory size (RSS) per worker | |
use Unicorn::WorkerKiller::Oom, (350*(1024**2)), (400*(1024**2)), 30, true | |
end |
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
json.array! @ranking.results_with_change.each_with_index.to_a do |args| | |
# We can't unpack the args in the block param because Jbuilder does | |
# something magic. | |
(user, player, diff), index = *args | |
json.rank index+1 | |
json.user user, :id, :facebook_id, :name, :square_avatar | |
json.score player.r.to_i | |
json.change_today diff.to_i |
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 'rblineprof' | |
module Rblineprof | |
module ConsoleHelpers | |
include Rblineprof::Helpers | |
def lineprof_block(options = {}, &block) | |
profile = lineprof(rblineprof_profiler_regex(options[:lineprofiler])) do | |
ret = yield | |
end |
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
/** | |
* | |
* Dinesh | |
* | |
* RootedTreeTraversal | |
* - Preorder Traversal | |
* - Postorder Traversal | |
* - Inorder Traversal | |
* - Levelorder Traversal | |
* |
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
import { Component } from "React"; | |
export var Enhance = ComposedComponent => class extends Component { | |
constructor() { | |
this.state = { data: null }; | |
} | |
componentDidMount() { | |
this.setState({ data: 'Hello' }); | |
} | |
render() { |
OlderNewer