Skip to content

Instantly share code, notes, and snippets.

View larryzhao's full-sized avatar
🐱
Meow

Larry Zhao larryzhao

🐱
Meow
View GitHub Profile
function batchImport(season, type) {
var script = "// Starting point \n $('.icon-btn-download').trigger('click'); \n\n";
var resourceType = type.toUpperCase();
var url
var timeout = 500;
console.log($(".resource-item[data-format=" + resourceType + "][data-season=" + season + "]").length);
$(".resource-item[data-format=" + resourceType + "][data-season=" + season + "]").each(function(index, element){
var $resourceItem = $(element);
@larryzhao
larryzhao / application_helper.rb
Created January 28, 2015 16:35
Newrelic Support
module ApplicationHelper
...
def present(object, klass = nil)
klass ||= "#{object.class}Presenter".constantize
presenter = klass.new(object, self)
yield presenter if block_given?
presenter
end
GIT
remote: git://gitcafe.com/larryzhao/rails_emoji.git
revision: d1831cddf39dff21384693cdf9e892fbc7603fe2
branch: maleskine
specs:
rails_emoji (1.7.0)
rails (>= 3.1.0)
GIT
remote: git://github.com/alexandru/stuff-classifier.git
// MySQLTest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include "mysql_connection.h"
#include "mysql_driver.h"
#include "cppconn\statement.h"
#include "cppconn\resultset.h"
@larryzhao
larryzhao / testruby.rb
Created March 31, 2011 23:04
just test
def thefunc
@this = "123"
end
@larryzhao
larryzhao / deploy.rb
Created March 15, 2012 10:58
torquebox.yml
require 'torquebox-capistrano-support'
require 'bundler/capistrano'
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.
require "rvm/capistrano" # Load RVM's capistrano plugin.
set :rvm_ruby_string, 'jruby-1.6.7@myapp'
set :use_sudo, false
set :stages, %w(staging production)
set :default_stage, "production"
require 'capistrano/ext/multistage'
$ cap deploy:start
triggering load callbacks
* executing `staging'
triggering start callbacks for `deploy:start'
* executing `multistage:ensure'
* executing `deploy:start'
Starting TorqueBox AS
* executing "nohup /usr/local/rvm/gems/jruby-1.6.7@global/gems/torquebox-server-2.0.0.cr1-java/jboss/bin/standalone.sh -b 0.0.0.0 < /dev/null > /dev/null 2>&1 &"
servers: ["domain"]
[domain] executing command
$ jruby json_text.rb
["に到着を待っている"] is in encoding: UTF-8
に到着を待っている is in encoding ASCII-8BIT
@larryzhao
larryzhao / spec result
Created March 26, 2012 09:58
twitter-text-rb extractor spec
Twitter::Extractor
mentions
should accept a block arugment and call it in order
single screen name alone
should be linked
should be linked with _
should be linked if numeric
multiple screen names
should both be linked
screen names embedded in text
@larryzhao
larryzhao / Capfile.rb
Created May 28, 2012 06:07
uninitialized constant Capistrano in rvm-capistrano
load 'deploy'
# Uncomment if you are using Rails' asset pipeline
# load 'deploy/assets'
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks