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 | |
# script/runner for rails 3.0 | |
APP_PATH = File.expand_path('../../config/environment', __FILE__) | |
require 'rubygems' | |
require 'rails/commands/runner' |
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/ruby | |
puts "input N" | |
i=gets.to_i | |
m=[1] | |
1.upto i do |j| | |
puts "input N#{j}" | |
k=gets.to_i | |
m.unshift m[0]*(k+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
// Keyboard shortcuts for browsing pages of lists | |
(function($) { | |
$(document).keydown(handleKey); | |
function handleKey(e) { | |
var left_arrow = 37; | |
var right_arrow = 39; | |
if (e.target.nodeName == 'BODY' || e.target.nodeName == 'HTML') { | |
if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey) { | |
var code = e.which; |
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
# auto deploy script | |
# content: sync update all servers code, control unicorn servers and thin servers | |
# by liuzihua | |
default_environment["LC_CTYPE"] = "en_US.UTF-8" | |
# servers! | |
set :server1, "124.42.34.226" | |
set :server2, "124.42.34.238" | |
set :server3, "119.254.7.196" |
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
task :requeue_failed do | |
(Resque::Failure.count-1).downto(0).each do |i| | |
Resque::Failure.requeue(i) | |
Resque::Failure.remove(i) | |
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
$ cat ~/.irbrc | |
cat: /Users/pbarry/.irbrc: No such file or directory | |
$ rails c | |
Loading development environment (Rails 4.0.0) | |
irb(main):001:0> Subscription.first | |
Subscription Load (2.5ms) SELECT "subscriptions".* FROM "subscriptions" ORDER BY "subscriptions"."id" ASC LIMIT 1 | |
=> nil | |
irb(main):002:0> puts ENV.keys.sort | |
Apple_PubSub_Socket_Render | |
Apple_Ubiquity_Message |
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
If you switch to kaminari, | |
http://railscasts.com/episodes/254-pagination-with-kaminari | |
...the lines added to application.js become redundant when you implement the pager like in this demo project: | |
https://github.com/amatsuda/kaminari_example/tree/ajax | |
in index.html: |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js'></script> | |
<script> | |
$(document).ready(function(){ | |
function debug(str){ $("#debug").append("<p>"+str+"</p>"); }; | |
if(typeof WebSocket === 'undefined') { | |
alert("Your browser does not support websockets.") | |
} |
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
// If you don't use underscore.js, use it (http://documentcloud.github.com/underscore/) | |
// Then, use underscore's mixin method to extend it with all your other utility methods | |
// like so: | |
_.mixin({ | |
escapeHtml: function () { | |
return this.replace(/&/g,'&') | |
.replace(/>/g,'>') | |
.replace(/</g,'<') | |
.replace(/"/g,'"') | |
.replace(/'/g,'''); |
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
<a href=""> | |
<div class="cbCoorBox_e"> | |
<img src="img/index/hanya.png" alt="合作机构"> | |
</div> | |
</a> |
OlderNewer