Skip to content

Instantly share code, notes, and snippets.

View candidosales's full-sized avatar
🏠
Focusing

Candido Sales Gomes candidosales

🏠
Focusing
View GitHub Profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=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')
pt-BR:
flash:
actions:
create:
notice: "%{resource_name} criado com sucesso."
alert: "* Preencha todos os campos corretamente."
update:
notice: "%{resource_name} foi atualizado com sucesso."
destroy:
notice: "%{resource_name} foi removido com sucesso."
@etagwerker
etagwerker / unicorn.default.rb
Created December 29, 2010 19:39
default unicorn configuration
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
# documentation.
worker_processes 2
# Help ensure your application will always spawn in the symlinked
# "current" directory that Capistrano sets up.
working_directory "/home/deployer/myapp.com/current"
# listen on both a Unix domain socket and a TCP port,
# we use a shorter backlog for quicker failover when busy
listen "/tmp/myapp.com.sock", :backlog => 64
listen 8080, :tcp_nopush => true
@JangoSteve
JangoSteve / ubuntu_rails_install.rb
Created January 22, 2011 17:58
Capistrano script to install Ruby, RVM, Rails in ubuntu (modified from deploy.rb scripts)
namespace :ubuntu do
desc "Setup Environment"
task :setup_env, :roles => :app do
update_apt_get
install_dev_tools
install_git
install_subversion
install_sqlite3
# Install and setup RVM instead of old Rails stack
#install_rails_stack
@lancejpollard
lancejpollard / node-folder-structure-options.md
Created November 28, 2011 01:50
What is your folder-structure preference for a large-scale Node.js project?

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
@matthutchinson
matthutchinson / std.js
Created January 20, 2012 17:37
Standard Deviation in Javascript
// http://jsfiddle.net/hiddenloop/TPeJt/
var array = [2, 3, 4, 6, 2, 5, 7, 2, 4, 5, 99];
var within_std_of = 3;
outputResult = function(str) {
var content = $('#results').html();
$('#results').html(content + str);
}
@yaraki
yaraki / dijkstra.rb
Created February 3, 2012 13:58
Dijkstra Shortest Path Algorithm in Ruby
#!/usr/bin/ruby1.9.1 -Kw
# -*- coding: utf-8 -*-
class Edge
attr_accessor :src, :dst, :length
def initialize(src, dst, length = 1)
@src = src
@dst = dst
@length = length
@gertig
gertig / 0_steps
Created March 31, 2012 20:26
VPS Setup and Deployment (Railscasts.com #335)
When building a new instance of Amazon EC2 choose quick-start-1 as the security group not default
#LOCALLY
$ capify .
$ chmod +x config/unicorn_init.sh
$ git add .
$ git commit -m "deployment configs"
If rebuilding an instance don't forget to remove the ssh keys
@awshout
awshout / foundation4-topbar-menu.php
Last active August 19, 2023 02:44
WordPress Menu & Walker for ZURB's Foundation 4 Top Bar
<?php
add_theme_support('menus');
/**
* Register Menus
* http://codex.wordpress.org/Function_Reference/register_nav_menus#Examples
*/
register_nav_menus(array(
'top-bar-l' => 'Left Top Bar', // registers the menu in the WordPress admin menu editor
'top-bar-r' => 'Right Top Bar'
@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………