Skip to content

Instantly share code, notes, and snippets.

View neutrino's full-sized avatar

ranendra adhikari neutrino

View GitHub Profile
#config/initializers/devise.rb
config.warden do |manager|
manager.strategies.add :token_header_authenticable, TokenHeaderAuthenticable
manager.default_strategies(:scope => :user).unshift :token_header_authenticable
end
#config/initializers/devise.rb
config.warden do |manager|
manager.strategies.add :token_header_authenticable, TokenHeaderAuthenticable
manager.default_strategies(:scope => :user).unshift :token_header_authenticable
end
# In config/initializers/local_override.rb:
require 'devise/strategies/authenticatable'
module Devise
module Strategies
class LocalOverride < Authenticatable
def valid?
true
end
#!/usr/bin/env bash
# Pre-requisites
apt-get -y update
sudo apt-get --no-install-recommends -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev
# Download and compile Ruby 2.0.0-p0
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz
tar -xvzf ruby-2.0.0-p0.tar.gz
description "Sync Gateway Upstart Script”
version "0.1.0"
author "Nicolas Lapomarda"
# Upstart has nothing in $PATH by default
env RUNAS=db
env HOME=/home/$RUNAS
env PATH=$HOME/sync_gateway/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
env PATH_TO_GATEWAY=$HOME/sync_gateway/bin/sync_gateway
@neutrino
neutrino / database_cleaner.rb
Created December 15, 2015 09:26 — forked from nowlinuxing/database_rewinder.rb
Database cleaner with sharding using ar-octopus
# spec/support/database_cleaner.rb
require 'database_cleaner'
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
end
@neutrino
neutrino / readme.md
Created June 5, 2018 23:31 — forked from maxivak/readme.md
Integrating Gem/Engine and Main Rails App
@neutrino
neutrino / digitalocean.md
Created June 15, 2018 01:40 — forked from JamesDullaghan/digitalocean.md
Deploy rails app to digitalocean with nginx, unicorn, capistrano & postgres

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh root@123.123.123.123

Add ssh fingerprint and enter password provided in email

@neutrino
neutrino / pr.md
Created February 8, 2020 05:14 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@neutrino
neutrino / stimulus.md
Created November 4, 2020 22:04 — forked from mrmartineau/stimulus.md
Stimulus cheatsheet