Skip to content

Instantly share code, notes, and snippets.

View nbarthelemy's full-sized avatar

Nick Barthelemy nbarthelemy

View GitHub Profile
Omniauth Facebook Error - Faraday::Error::ConnectionFailed
Faraday::Error::ConnectionFailed
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, '<key from fb>', '<another key from fb>'
end
class SessionsController < ApplicationController
def create
#!/usr/bin/env ruby
# Usage: gemspec [-s] GEMNAME
#
# Prints a basic gemspec for GEMNAME based on your git-config info.
# If -s is passed, saves it as a GEMNAME.gemspec in the current
# directory. Otherwise prints to standard output.
#
# Once you check this gemspec into your project, releasing a new gem
# is dead simple:
#
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet" type="text/css" />
<script src="http://twitter.github.com/bootstrap/assets/js/bootstrap.js"></script>
<meta charset=utf-8 />
</head>
<body>
var AbstractManager = Class.create({
__element_class: '',
__management_class: null,
initialize: function(element){
this.__instances = {};
this.__selected_instance = null;
this.__token = this.__element_class.replace('.','');
this.register(element ? $(element).select(this.__element_class) : $$(this.__element_class));
def countries
if defined?(I18n)
def countries
I18n.t(:countries)
end
countries
else
COUNTRIES
end
end
require 'find'
namespace :db do
desc "Backup the database to a file. Options: DIR=base_dir RAILS_ENV=production MAX=20"
task :backup => [:environment] do
datestamp = Time.now.strftime("%Y-%m-%d_%H-%M-%S")
base_path = ENV["DIR"] || "db"
backup_base = File.join(base_path, 'backup')
backup_folder = File.join(backup_base, datestamp)
backup_file = File.join(backup_folder, "#{RAILS_ENV}_dump.sql.gz")
.git/hooks/pre-commit 2>&1 | sed '/^\*/d' | sed 's/:.*//' | uniq
for FILE in `.git/hooks/pre-commit 2>&1 | sed '/^\*/d' | sed 's/:.*//' | uniq` ; do sed -ie 's/[[:space:]]*$//' $FILE ; done
@nbarthelemy
nbarthelemy / JQuey.fn.apply
Created March 19, 2009 20:37
jquery apply utility function
(function ($) {
$.extend($.fn, {
apply :function (fn, args) {
return this.each(function () {
fn.apply(this, args);
});
}
});
})(jQuery);