Skip to content

Instantly share code, notes, and snippets.

#=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_on('Button Value')
@andrey-skat
andrey-skat / deploy.rb
Last active August 5, 2018 12:03
Local assets precompilation on Rails 4 using Capistrano 3
# also you need to uncomment next line in Capfile
# require 'capistrano/rails/assets'
namespace :deploy do
namespace :assets do
Rake::Task['deploy:assets:precompile'].clear_actions
desc 'Precompile assets locally and upload to servers'
task :precompile do
@afeld
afeld / gist:5704079
Last active November 27, 2023 15:43
Using Rails+Bower on Heroku
@MikeRogers0
MikeRogers0 / twitter-proxy.php
Last active June 3, 2019 12:56
This is a neat little script you can use to quickly make OAuth requests to the twitter rest API v1.1.
<?php
/**
* Usage:
* Send the url you want to access url encoded in the url paramater, for example (This is with JS):
* /twitter-proxy.php?url='+encodeURIComponent('statuses/user_timeline.json?screen_name=MikeRogers0&count=2')
*/
// The tokens, keys and secrets from the app you created at https://dev.twitter.com/apps
$config = array(
@farleyknight
farleyknight / Gemfile
Created December 2, 2012 20:08
ComfortableMexicanSofa (CMS) + Spree + Devise + OmniAuth + Heroku
source 'https://rubygems.org'
gem 'rails', '3.2.9'
# Postgres Database
gem 'pg'
# Twitter API
gem 'twitter'
@anthonyshort
anthonyshort / _image-rendering.sass
Created October 28, 2012 05:15
Image rendering mixins
// Sharpen an image if it has become blurry due to upscaling or downscaling
// https://developer.mozilla.org/en/CSS/image-rendering
@mixin sharpen-image
image-rendering:-moz-crisp-edges
// When photos are upscaled or downscaled, they often get blurry. Don't use
// this on flat color images, they will still appear blurry.
// https://developer.mozilla.org/en/CSS/image-rendering
@mixin high-quality-image
image-rendering:optimizeQuality
@kamiaka
kamiaka / convert_kana.js
Last active August 3, 2023 03:50
JS Convert "Kana" one from another (zen-kaku, han-kaku and more)
/**
* Convert "Kana" one from another
* (zen-kaku, han-kaku and more)
*
* @param string str
* @param string option (optionaly)
* @return string converted string
*/
function convert_kana (str, option) {
option = option || "KV";
@wrburgess
wrburgess / gist:2187164
Created March 24, 2012 19:37
Setting up a Rails has_many :through relationship with meaningful relationship table #rails #activerecord #relations

##References

##Create Models

Create tables:

rails g model Location
rails g model User
rails g model Checkin
@rstacruz
rstacruz / index.md
Last active November 3, 2023 09:56
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@mbostock
mbostock / .block
Last active June 9, 2024 02:00
Polar Clock
license: gpl-3.0