In your shell:
cd ~/.vim
git clone git://github.com/juvenn/mustache.vim.git
mv mustache.vim/syntax/* syntax/
mv mustache.vim/indent/* indent/
mv mustache.vim/ftdetect/* ftdetect/rm -rf mustache.vim
| # -*- encoding: utf-8 -*- | |
| require 'digest/md5' | |
| require 'nestful' | |
| class Smsbao | |
| def initialize(login, passwd) | |
| @login = login | |
| @passwd = Digest::MD5.hexdigest(passwd.to_s) | |
| end |
| MySQL: SELECT * FROM user WHERE name = "foobar" | |
| Mongo: db.user.find({"name" : "foobar"}) | |
| MySQL: INSERT INOT user (`name`, `age`) values ("foobar", 25) | |
| Mongo: db.user.insert({"name" : "foobar", "age" : 25}) | |
| MySQL: DELETE * FROM user | |
| Mongo: db.user.remove({}) | |
| MySQL: DELETE FROM user WHERE age < 30 | |
| Mongo: db.user.remove({"age" : {$lt : 30}}) $gt : > ; $gte : >= ; $lt : < ; $lte : <= ; $ne : != | |
| MySQL: UPDATE user SET `age` = 36 WHERE `name` = "foobar" | |
| Mongo: db.user.update({"name" : "foobar"}, {$set : {"age" : 36}}) |
| #!/usr/bin/env ruby | |
| require 'bundler' | |
| Bundler.setup(:default, :test) if defined?(Bundler) | |
| require "selenium-webdriver" | |
| require 'capybara/dsl' | |
| Capybara.default_driver = :selenium | |
| Capybara.default_selector = :css | |
| Capybara.default_wait_time = 5 |
| helpers do | |
| def format | |
| (params[:format] || :json).to_sym | |
| end | |
| def render_to(format, results) | |
| case format | |
| when :json | |
| results.to_json | |
| when :xml |
| require 'oauth_util.rb' | |
| require 'net/http' | |
| o = OauthUtil.new | |
| o.consumer_key = 'examplek9SGJUTUpocjZ5QjBJmQ9WVdrOVVFNHdSR2x1TkhFbWNHbzlNQS0tJnM9Y29uc3VtkZXJzZWNyZXQmeD0yYg--'; | |
| o.consumer_secret = 'exampled88d4109c63e778dsadcdd5c1875814977'; | |
| url = 'http://query.yahooapis.com/v1/yql?q=select%20*%20from%20social.updates.search%20where%20query%3D%22search%20terms%22&diagnostics=true'; |
In your shell:
cd ~/.vim
git clone git://github.com/juvenn/mustache.vim.git
mv mustache.vim/syntax/* syntax/
mv mustache.vim/indent/* indent/
mv mustache.vim/ftdetect/* ftdetect/rm -rf mustache.vim
| require 'rubygems' | |
| require 'sinatra' | |
| require 'datamapper' | |
| require 'dm-paperclip' | |
| require 'haml' | |
| require 'fileutils' | |
| APP_ROOT = File.expand_path(File.dirname(__FILE__)) | |
| DataMapper::setup(:default, "sqlite3://#{APP_ROOT}/db.sqlite3") |
| # A polymorphic has_many :through relationship in Rails 2.3 | |
| # based on Josh Susser's "The other side of polymorphic :through associations" | |
| # http://blog.hasmanythrough.com/2006/4/3/polymorphic-through | |
| class Authorship < ActiveRecord::Base | |
| belongs_to :author | |
| belongs_to :publication, :polymorphic => true | |
| end | |
| class Author < ActiveRecord::Base | |
| has_many :authorships |
| loop do | |
| print '>> ' | |
| output = eval($stdin.gets) | |
| print '=> ' | |
| puts output.inspect | |
| end |