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 'rubygems' | |
require 'openwfe/engine/file_persisted_engine' # sudo gem install ruote | |
engine = OpenWFE::FilePersistedEngine.new( | |
:definition_in_launchitem_allowed => true) | |
# | |
# the process definition | |
class MyTodoProcess < OpenWFE::ProcessDefinition |
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
# You can test whether an object is compliant with the ActiveModel API by | |
# including ActiveModel::Lint::Tests in your TestCase. It will included | |
# tests that tell you whether your object is fully compliant, or if not, | |
# which aspects of the API are not implemented. | |
# | |
# These tests do not attempt to determine the semantic correctness of the | |
# returned values. For instance, you could implement valid? to always | |
# return true, and the tests would pass. It is up to you to ensure that | |
# the values are semantically meaningful. | |
# |
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 Person | |
attr_reader :name | |
def initialize(name = nil) | |
@name = name | |
end | |
def loud_name | |
@name.upcase | |
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
#!/bin/sh | |
# Rails 3 - Quick install via CURL | |
# This will not install using Gem; can update via git-pull | |
# curl -L# http://gist.github.com/279171.txt | sh | |
# Tested on OSX and Ubuntu/Debian | |
# -- Bryan Goines | |
git clone git://github.com/rails/rails.git |
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
puts <<ASCII | |
/´¯/) | |
,/¯ / | |
/ / | |
/´¯/' '/´¯¯`·¸ | |
/'/ / / /¨¯\\ | |
('( ´ ´ ¯~/' ') | |
\\ ' / | |
'' \\ _ ·´ | |
\\ ( |
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 PagesController < ApplicationController | |
before_filter :login_required, :except => [ :show ] | |
# GET /pages | |
# GET /pages.xml | |
def index | |
@pages = Page.find(:all) | |
respond_to do |format| | |
format.html # index.html.erb |
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://gist.github.com/343293 | |
# it's for rails 1.2.5 | |
# add require 'add_delete.rb' in environment.rb | |
class ActiveRecord::Base | |
def delete! | |
unless new_record? | |
affected_rows = connection.delete("DELETE FROM `#{self.class.table_name}` WHERE #{connection.quote_column_name(self.class.primary_key)} = #{quoted_id}", "#{self.class.name} Destroy") | |
unless affected_rows == 1 |
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
#此DEMO的功能:查询手机类的淘客商品 | |
require 'digest/md5' | |
require 'net/http' | |
require 'open-uri' | |
require 'iconv' | |
#获得当前时间 | |
t = Time.new(); | |
#组装参数 |
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
/*! | |
* jQuery queueFn - v0.5 - 06/18/2010 | |
* http://benalman.com/ | |
* | |
* Copyright (c) 2010 "Cowboy" Ben Alman | |
* Dual licensed under the MIT and GPL licenses. | |
* http://benalman.com/about/license/ | |
*/ | |
(function($){ |
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
/* | |
Usages: | |
$(selector).classList() //returns an array of classnames | |
$(selector).classList('newclass') //replaces the current element's classes | |
$(selector).classList(['new', 'class', 'names']) //replaces the current element's classes | |
*/ | |
jQuery.fn.classList = function( classNames ) { | |
if ( jQuery.isArray( classNames ) ) { | |
// An array was passed, join it into a string. |
OlderNewer