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
source 'https://rubygems.org' | |
gem 'rails', '3.2.7' | |
# Bundle edge Rails instead: | |
# gem 'rails', :git => 'git://github.com/rails/rails.git' | |
# Gems used only for assets and not required | |
# in production environments by default. | |
group :assets do |
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
>rails new Railsbackbone | |
>cd backbone_rails | |
#edit Gemfile | |
gem 'rails-backbone' | |
>bundle install | |
>rails g scaffold Post title:string content:string | |
>rake db:migrate |
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
<?php | |
$dir = './images/';//note the trailing slashes | |
foreach (new DirectoryIterator($dir) as $fileInfo) | |
if(!$fileInfo->isDot()) { | |
if ($fileInfo->isFile()) | |
unlink($fileInfo->getFilename()); | |
if ($fileInfo->isDir()) | |
rmdir($fileInfo->getPath().'/'.$fileInfo->getFilename().'/'); | |
} |
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
# config/initializers/omniauth.rb | |
module OmniAuth | |
module Strategies | |
# tell OmniAuth to load our strategy | |
autoload :Pixelation, 'lib/pixelation_strategy' | |
end | |
end | |
Rails.application.config.middleware.use OmniAuth::Builder do | |
provider :twitter, "app_name", "secret" |
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
def my_method(foo, bar) | |
memoize(:my_method, foo, bar) do | |
foo * bar | |
end | |
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 'benchmark' | |
class Fib | |
def fib(n) | |
return n if n < 2 | |
return fib(n-1) + fib(n-2) | |
end | |
end | |
def memoize(className, methodName) |
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
{ | |
"name": "app-name", | |
"version": "0.1.0", | |
"author": "nXqd", | |
"description": "app-description", | |
"dependencies": { | |
"request": "*", | |
"connect": "*" | |
}, | |
"engines": { |
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
/* | |
* HTML5 ✰ Boilerplate | |
* | |
* What follows is the result of much research on cross-browser styling. | |
* Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal, | |
* Kroc Camen, and the H5BP dev community and team. | |
* | |
* Detailed information about this CSS: h5bp.com/css | |
* | |
* ==|== normalize ========================================================== |
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
// Change the default message of jquery validation | |
jQuery.extend(jQuery.validator.messages, { | |
required: "This field is required.", | |
remote: "Please fix this field.", | |
email: "Please enter a valid email address.", | |
url: "Please enter a valid URL.", | |
date: "Please enter a valid date.", | |
dateISO: "Please enter a valid date (ISO).", | |
number: "Please enter a valid number.", | |
digits: "Please enter only digits.", |
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
# back button | |
<%= link_to 'Back', :back %> |
OlderNewer