Skip to content

Instantly share code, notes, and snippets.

View yorzi's full-sized avatar
🏠
Working from home

Andy Wang yorzi

🏠
Working from home
  • Xi'an, China
  • 10:47 (UTC +08:00)
View GitHub Profile
@yorzi
yorzi / check_device.js
Created January 27, 2014 13:23
check user agent and do something special.
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){
$('body').removeClass("force-desktop");
} else {
$('.chzn-select').chosen();
}
zh-CN:
admin:
home:
name: "首页"
pagination:
previous: "« 上一页"
next: "下一页 »"
truncate: "…"
misc:
filter_date_format: "mm/dd/yy" # a combination of 'dd', 'mm' and 'yy' with any delimiter. No other interpolation will be done!
@yorzi
yorzi / media_queries.css
Created January 12, 2014 01:59
Media Queries for Standard Devices
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
@yorzi
yorzi / Gemfile
Created January 9, 2014 04:10
Gemfile for BibRave.com
source 'http://rubygems.org'
# source 'http://ruby.taobao.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.1'
#
# Use postgresql as the database for Active Record
gem 'pg'
# for heroku deployment
@yorzi
yorzi / Gemfile
Created November 18, 2013 12:48
A group of basic reusable settings/configs for a new rails project.
source 'http://rubygems.org'
# source 'http://ruby.taobao.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.1'
#
# Use postgresql as the database for Active Record
gem 'pg'
# for heroku deployment
@yorzi
yorzi / tooltips-for-d3-line.coffee
Created June 27, 2013 15:02
add simple tooltips for a line that's based on d3
svg.selectAll('.views_dot')
.data(data)
.enter()
.append('circle')
.attr("transform", "translate(10, 0)")
.attr('class', 'views_dot')
.attr('fill-opacity', 0)
.attr('cx', (d)->
x( new Date(d.date) )
)
@yorzi
yorzi / gernerator.rb
Created May 23, 2013 09:29
Some useful initialisers for Rails projects.
# don't generate RSpec tests for views and helpers by default
Rails.application.config.generators do |g|
g.view_specs false
g.helper_specs false
g.stylesheets false
g.helper false
g.javascripts false
g.template_engine :haml
g.form_builder :simple_form
g.test_framework :rspec, fixture: true, view_specs: false
@yorzi
yorzi / dev.rake
Created May 22, 2013 01:41
copies the config/*.example.yml files be the usable config/*.yml versions
namespace :development do
desc "copies the config/*.example.yml files be the usable config/*.yml versions"
task :configure do
Dir.glob('config/*.yml.example').each do |filename|
sh "cp #{filename} #{filename.gsub('.example', '')}"
end
end
task :configure_all_but_database do
(Dir.glob('config/*.yml.example') - ["config/database.yml.example"]).each do |filename|
sh "cp #{filename} #{filename.gsub('.example', '')}"
@yorzi
yorzi / start_stop_jenkins.md
Created May 21, 2013 06:03
Start and Stop Jenkins on Mac

Start Jenkins:

sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

Stop Jenkins:

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist