Skip to content

Instantly share code, notes, and snippets.

View cyberplanner's full-sized avatar

Sal Abuewilly cyberplanner

  • London
View GitHub Profile
@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
@schleg
schleg / 01. Gemfile
Created May 26, 2011 17:26
Setup for Devise + Omniauth
gem 'pg'
group :development do
gem 'ruby-debug'
end
gem 'rake', '~> 0.8.7'
gem 'devise'
gem 'oa-oauth', :require => 'omniauth/oauth'
gem 'omniauth'
gem 'haml'
gem 'dynamic_form'
@nbrew
nbrew / authinabox.rb
Created December 7, 2011 20:29 — forked from peterc/gist:40246
Single File Data Mapper Authentication for Sinatra
# NAME: authinabox
# VERSION: 1.01 (Dec 27, 2008)
# AUTHOR: Peter Cooper [ http://www.rubyinside.com/ github:peterc twitter:peterc ]
# DESCRIPTION: An "all in one" Sinatra library containing a User model and authentication
# system for both session-based logins OR HTTP Basic auth (for APIs, etc).
# This is an "all in one" system so you will probably need to heavily tailor
# it to your own ideas, but it will work "out of the box" as-is.
# COMPATIBILITY: - Tested on 0.3.2 AND the latest rtomayko Hoboken build! (recommended for the latter though)
# - NEEDS DataMapper!
# - Less work needed if you use initializer library -- http://gist.github.com/40238
@jrgifford
jrgifford / install-shoes.sh
Created January 5, 2012 21:20
install shoes on ubuntu
#!/bin/bash
sudo apt-get install -y git-core ruby-rvm libcairo2-dev libpixman-1-dev libpango1.0-dev libgif-dev libjpeg-dev libgtk2.0-dev vlc libvlc-dev portaudio19-dev libsqlite3-dev libcurl4-openssl-dev libxslt1-dev makeself curl libxslt-dev libxml2-dev
\# Load RVM into a shell session *as a function*
if [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
\# Then try to load from a root install
source "/usr/local/rvm/scripts/rvm"
else
@rainly
rainly / gist:1990246
Created March 7, 2012 01:16
Installing pgAdmin3 from source on linux(mint)
准备:
libxml2 2.6.18 or above from http://www.xmlsoft.org/
libxslt 1.1.x or above from http://www.xmlsoft.org/
先查看当前系统中是否有安装libxml2,libxslt这两个库,如果没有请到下面的网站中去下载安装
# sudo apt-get install libxml2-dev
# sudo apt-get install libxslt1-dev
由于安装pgAdmin3需要wxGTK,所以也要下载wxGTK
wxGTK 2.8.x from http://www.wxwidgets.org/
@nerocrux
nerocrux / fizzbuzz.rb
Created May 11, 2012 18:15
fizzbuzz without mod (ruby)
def fizzbuzz(fizz,buzz,fizzbuzz,counter)
if fizzbuzz == 15
print("fizzbuzz ")
fizzbuzz = 0
fizz = 0
buzz = 0
elsif fizz == 3
print("fizz ")
fizz = 0
elsif buzz == 5
@StefanLage
StefanLage / Array-Equilibrium
Last active March 31, 2022 19:59
Technical Interview : Equilibrium index of an Array
int equilibrium (int A[], int n){
int sum = 0;
int solution = -1;
int leftSum = 0;
int rightSum = 0;
// Calculate the sum of all P in A
for (int i = 0; i < n; i++)
sum += A[i];
// Try to find an equilibrium -> if yes return the first one
for (int i = 0; i < n; i++){
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@tmarshall
tmarshall / aws-sns-example.js
Last active October 30, 2022 06:12
aws-sdk sns example, in Node.js
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: '{AWS_KEY}',
secretAccessKey: '{AWS_SECRET}',
region: '{SNS_REGION}'
});
var sns = new AWS.SNS();
@renshuki
renshuki / ubuntu_agnoster_install.md
Last active July 11, 2024 15:06
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH