Skip to content

Instantly share code, notes, and snippets.

View SergeyKishenin's full-sized avatar
🥴

Sergey Kishenin SergeyKishenin

🥴
View GitHub Profile
package :imagemagick do
description "ImageMagick"
version '6.5.4-10'
source "ftp://ftp.fifi.org/pub/ImageMagick/ImageMagick-#{version}.tar.gz" do
prefix '/usr'
disable 'static'
enable 'shared'
with %w(modules quantum-depth=8)
without %w(perl magick-plus-plus)
@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')
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
devise :database_authenticatable , :registerable, :recoverable, :rememberable, :trackable, :validatable
devise :omniauthable#, :omniauth_providers => [:facebook]
devise :encryptable, :encryptor => :custom_encryptor
# Devise: Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
@mejibyte
mejibyte / gist:791105
Created January 22, 2011 12:56
Test Omniauth Callback Controllers in Devise
# encoding: utf-8
require 'test_helper'
class Users::OmniauthCallbacksControllerTest < ActionController::TestCase
context "Facebook callback" do
setup do
# This a Devise specific thing for functional tests. See https://github.com/plataformatec/devise/issues/closed#issue/608
request.env["devise.mapping"] = Devise.mappings[:user]
end
@jittuu
jittuu / gist:792715
Created January 24, 2011 02:19
Test Omniauth Facebook Callback Controllers in Devise with rspec
require 'spec_helper'
describe Users::OauthCallbacksController, "handle facebook authentication callback" do
describe "#annonymous user" do
context "when facebook email doesn't exist in the system" do
before(:each) do
stub_env_for_omniauth
get :facebook
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@nono
nono / blowfish.rb
Created June 26, 2012 10:57
How to encrypt and decrypt Blowfish in Ruby 1.9 with https://github.com/drench/blowfish.js
#!/usr/bin/env ruby
require "openssl"
class BF < Struct.new(:key, :pad_with_spaces)
def encrypt(str)
cipher = OpenSSL::Cipher.new('bf-ecb').encrypt
if pad_with_spaces
str += " " until str.bytesize % 8 == 0
cipher.padding = 0
@dgilperez
dgilperez / delayed_job
Created July 3, 2012 18:27
Delayed_job init script for linux
#!/bin/sh
set_path="cd /home/rails/my_app/current"
case "$1" in
start)
echo -n "Starting delayed_job: "
su - rails -c "$set_path; RAILS_ENV=production script/delayed_job start" >> log/delayed_job.log 2>&1
echo "done."
;;
stop)
@mikhailov
mikhailov / 0. nginx_setup.sh
Last active December 26, 2022 19:30
Nginx + secure pseudo-streaming
# Nginx can serve FLV/MP4 files by pseudo-streaming way without any specific media-server software.
# To do the custom build we use 2 modules: --with-http_secure_link_module --with-http_flv_module
# This module "secure-link" helps you to protect links from stealing away.
#
# NOTE: see more details at coderwall: http://coderwall.com/p/3hksyg
cd /usr/src
wget http://nginx.org/download/nginx-1.5.13.tar.gz
tar xzvf ./nginx-1.5.13.tar.gz && rm -f ./nginx-1.5.13.tar.gz
@franckverrot
franckverrot / gist:3435648
Created August 23, 2012 11:09 — forked from joelmoss/gist:2470666
Capistrano recipe for Puma start/stop/restarts
set :shared_children, shared_children << 'tmp/sockets'
namespace :deploy do
desc "Start the application"
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && RAILS_ENV=#{stage} bundle exec puma -b 'unix://#{shared_path}/sockets/puma.sock' -S #{shared_path}/sockets/puma.state --control 'unix://#{shared_path}/sockets/pumactl.sock' >> #{shared_path}/log/puma-#{stage}.log 2>&1 &", :pty => false
end
desc "Stop the application"
task :stop, :roles => :app, :except => { :no_release => true } do