This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
class Palindrome | |
return string if string.length == 1 | |
l = "" | |
string.size.times do |i| | |
break if string.size - i <= l.size | |
c = -1 | |
while (a = string.rindex(string[i], c)) != i || a - i > l.size do | |
b = string[i..a] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
rolify :after_add => :event_added_mew_role #, :role_cname => 'Role' | |
accepts_nested_attributes_for :roles | |
attr_accessible :roles_attributes | |
# Include default devise modules. Others available are: | |
# :confirmable, | |
# :lockable, :timeoutable and :omniauthable | |
devise :database_authenticatable, :registerable, :token_authenticatable, | |
:recoverable, :rememberable, :trackable, :validatable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pod::Spec.new do |s| | |
s.name = "ReactiveCocoa" | |
s.version = "1.9.6" | |
s.summary = "A framework for composing and transforming sequences of values." | |
s.homepage = "https://github.com/blog/1107-reactivecocoa-is-now-open-source" | |
s.author = { "Josh Abernathy" => "[email protected]" } | |
s.source = { :git => "https://github.com/ReactiveCocoa/ReactiveCocoa.git", :tag => "v#{s.version}" } | |
s.license = 'Simplified BSD License' | |
s.description = "ReactiveCocoa offers:\n" \ | |
"1. The ability to compose operations on future data.\n" \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unless File.exists?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
gem 'sqlite3' | |
GEMFILE | |
system 'bundle' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
# original idea comes from http://darwinweb.net/articles/convert-syck-to-psych-yaml-format | |
namespace :encoding do | |
desc 'convert serialized Content data from syck yaml serializations to psych' | |
task :psych => :environment do | |
content_id = ENV['content_id'] | |
if content_id | |
convert_data Content.find(content_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unless File.exists?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
gem 'sqlite3' | |
gem 'activerecord_any_of' | |
gem 'pry' | |
gem 'pg' | |
GEMFILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unless File.exists?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
gem 'sqlite3' | |
gem 'activerecord_any_of' | |
gem 'pry' | |
gem 'pg' | |
GEMFILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unless File.exists?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
gem 'sqlite3' | |
gem 'pry' | |
gem 'pg' | |
GEMFILE | |
system 'bundle' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://www.xaprb.com/blog/2005/12/12/javascript-closures-for-runtime-efficiency/ | |
/* | |
* Copyright (C) 2004 Baron Schwartz <baron at sequent dot org> | |
* | |
* This program is free software; you can redistribute it and/or modify it | |
* under the terms of the GNU Lesser General Public License as published by the | |
* Free Software Foundation, version 2.1. | |
* | |
* This program is distributed in the hope that it will be useful, but WITHOUT | |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+requirements_osx_brew_libs_install:2> brew unlink libksba | |
Error: No such keg: /usr/local/Cellar/libksba | |
+requirements_osx_brew_libs_install:2> true | |
+requirements_osx_brew_libs_install:3> brew install libksba | |
==> Downloading ftp://ftp.gnupg.org/gcrypt/libksba/libksba-1.3.0.tar.bz2 | |
Already downloaded: /Library/Caches/Homebrew/libksba-1.3.0.tar.bz2 | |
==> ./configure --prefix=/usr/local/Cellar/libksba/1.3.0 | |
==> make install | |
libtool: link: cannot determine absolute directory name of `@@HOMEBREW_CELLAR@@/libgpg-error/1.12/lib' | |
make[2]: *** [libksba.la] Error 1 |
OlderNewer