Skip to content

Instantly share code, notes, and snippets.

Brad Folkens bfolkens

Block or report user

Report or block bfolkens

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View daemonize.c
/*
* daemonize.c
* This example daemonizes a process, writes a few log messages,
* sleeps 20 seconds and terminates afterwards.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
View gist:2d661b0494b0cfd7cb56
<a href="http://twitter.com/bfolkens"><img src="/path/to/image.png"></a>
View gist:7f27b42d2ec1f28ccf3b
#!/usr/bin/env ruby
require 'open-uri'
require 'csv'
CSV.open('infile.csv') do |csv|
csv.each do |row|
url = row[0]
open(url) do |infile|
rootname = File.basename(url)
View New tynt code for jrank.org
View gist:251423
diff --git a/lib/authlogic_oauth/acts_as_authentic.rb b/lib/authlogic_oauth/acts_as_authentic.rb
index ddc313c..a929aee 100644
--- a/lib/authlogic_oauth/acts_as_authentic.rb
+++ b/lib/authlogic_oauth/acts_as_authentic.rb
@@ -45,11 +45,11 @@ module AuthlogicOauth
validates_uniqueness_of klass.oauth_token_field, :scope => validations_scope, :if => :using_oauth?
validates_presence_of klass.oauth_secret_field, :scope => validations_scope, :if => :using_oauth?
- validates_length_of_password_field_options validates_length_of_password_field_options.merge(:if => :validate_password_with_oauth?)
- validates_confirmation_of_password_field_options validates_confirmation_of_password_field_options.merge(:if => :validate_password_with_oauth?)
View gist:251422
diff --git a/lib/authlogic_openid/acts_as_authentic.rb b/lib/authlogic_openid/acts_as_authentic.rb
index 92c9c52..c0be2e7 100644
--- a/lib/authlogic_openid/acts_as_authentic.rb
+++ b/lib/authlogic_openid/acts_as_authentic.rb
@@ -45,9 +45,9 @@ module AuthlogicOpenid
klass.class_eval do
validates_uniqueness_of :openid_identifier, :scope => validations_scope, :if => :using_openid?
validate :validate_openid
- validates_length_of_password_field_options validates_length_of_password_field_options.merge(:if => :validate_password_with_openid?)
- validates_confirmation_of_password_field_options validates_confirmation_of_password_field_options.merge(:if => :validate_password_with_openid?)
View authlogic_facebook_connect_registrations.diff
diff --git a/vendor/plugins/authlogic_facebook_connect/lib/authlogic_facebook_connect/acts_as_authentic.rb b/vendor/plugins/authlogic_facebook_connect/lib/authlogic_facebook_connect/acts_as_authentic.rb
index fb9fa1b..9f08b05 100644
--- a/vendor/plugins/authlogic_facebook_connect/lib/authlogic_facebook_connect/acts_as_authentic.rb
+++ b/vendor/plugins/authlogic_facebook_connect/lib/authlogic_facebook_connect/acts_as_authentic.rb
@@ -11,10 +11,32 @@ module AuthlogicFacebookConnect
end
module Methods
+ # Set up some simple validations
def self.included(klass)
@bfolkens
bfolkens / gist:1046481
Created Jun 25, 2011
ArgumentError from to_xs call in Builder
View gist:1046481
ArgumentError: wrong number of arguments (1 for 0)
from /Users/bfolkens/.rvm/gems/ruby-1.8.7-p334@rails31/gems/builder-3.0.0/lib/builder/xmlbase.rb:135:in `to_xs'
from /Users/bfolkens/.rvm/gems/ruby-1.8.7-p334@rails31/gems/builder-3.0.0/lib/builder/xmlbase.rb:135:in `_escape'
from /Users/bfolkens/.rvm/gems/ruby-1.8.7-p334@rails31/gems/builder-3.0.0/lib/builder/xmlbase.rb:140:in `_escape_quote'
from /Users/bfolkens/.rvm/gems/ruby-1.8.7-p334@rails31/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:320:in `_attr_value'
from /Users/bfolkens/.rvm/gems/ruby-1.8.7-p334@rails31/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:308:in `_insert_attributes'
from /Users/bfolkens/.rvm/gems/ruby-1.8.7-p334@rails31/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:306:in `each'
from /Users/bfolkens/.rvm/gems/ruby-1.8.7-p334@rails31/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:306:in `_insert_attributes'
from /Users/bfolkens/.rvm/gems/ruby-1.8.7-p334@rails31/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:284:in `_special'
from /Users/bf
@bfolkens
bfolkens / 1859-argumenterror-for-toxs.patch
Created Jun 29, 2011
1859-argumenterror-for-toxs.patch
View 1859-argumenterror-for-toxs.patch
--- activesupport-3.1.0.rc4/lib/active_support/core_ext/string/xchar.rb 2011-06-27 13:09:24.000000000 -0500
+++ activesupport-3.1.0.rc4.patched/lib/active_support/core_ext/string/xchar.rb 2011-06-25 10:09:06.000000000 -0500
@@ -13,6 +13,13 @@
class String
alias_method :original_xs, :to_xs if method_defined?(:to_xs)
- alias_method :to_xs, :fast_xs
+
+ # to_xs expects 0 args from Builder < 3 but not >= 3, although fast_xs is 0 args
+ if instance_method(:to_xs).arity == 0
@bfolkens
bfolkens / retrieve.js
Last active Dec 9, 2015
Retrieve image response from server
View retrieve.js
var key = 'YOUR API KEY';
var token = 'THE TOKEN FROM THE REQUEST RESPONSE';
var poll = function() {
$.ajax({
'async': true,
'crossDomain': true,
'url': 'https://api.cloudsightapi.com/image_responses/' + token,
'method': 'GET',
'headers': {
You can’t perform that action at this time.