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
var require = function (file, cwd) { | |
var resolved = require.resolve(file, cwd || '/'); | |
var mod = require.modules[resolved]; | |
if (!mod) throw new Error( | |
'Failed to resolve module ' + file + ', tried ' + resolved | |
); | |
var res = mod._cached ? mod._cached : mod(); | |
return res; | |
} |
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
request = require 'request' | |
memeGenerator = 'http://version1.api.memegenerator.net/Instance_Create' | |
imageUri = 'http://images.memegenerator.net/instances' | |
[username, password, languageCode] = ['xxx', 'xxx', 'en'] | |
instanceCreate = (generatorID, imageID, text0, text1, cb) -> | |
request memeGenerator, | |
form: { username, password, languageCode, generatorID, imageID, text0, text1 } | |
(e, r, b) -> | |
result = JSON.parse(b)['result'] |
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
# application.js | |
$(document).ready( function(){ | |
$(‘#product_category’).autocomplete(‘/categories.js’); | |
}); |
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
# new.html.haml – in Products Controller | |
- form_for :product, :url => products_path do |f| | |
%p | |
= f.label :category | |
= f.text_field :category |
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
# index.js.haml | |
= render :text => @categories.map(&:name) |
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
# categories_controller.rb | |
def index | |
if params[:q] | |
@categories = Category.all(:conditions => ["name like ?", params[:q] + '%']) | |
else | |
@categories = Category.all | |
end | |
respond_to do |wants| |
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
# categories_controller.rb | |
def index | |
if params[:q] | |
@categories = Category.all(:conditions => ["name like ?", params[:q] + '%']) | |
else | |
@categories = Category.all | |
end | |
respond_to do |wants| |
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
selector = '.ui-menu-item a:contains(\"Jack Russell Software\")' | |
fill_in 'Name', :with => 'Jack' | |
sleep(3) | |
page.execute_script " $('#{selector}'). | |
trigger(\"mouseenter\").click();" |
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
cd ~ | |
git clone git://github.com/tpope/vim-pathogen.git | |
mv vim-pathogen/ .vim | |
git clone git://gist.github.com/578250.git | |
mv 578250/Upload_bundle.rb ~/.vim/upload_bundle | |
git clone git://gist.github.com/578252.git | |
mv 578252/Vimrc ~/.vimrc | |
cd ~/.vim | |
chmod u+x upload_bundle | |
mkdir 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
filetype off | |
pathogen#helptags() | |
call pathogen#runtime_append_all_bundles() | |
syntax on | |
filetype plugin indent on | |
set tabstop=2 | |
set smarttab |
NewerOlder