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
  • 12:25 (UTC +08:00)
View GitHub Profile
@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 / 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) {
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 / 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();
}
@yorzi
yorzi / paper_trail_history.rb
Last active August 29, 2015 14:04
paper_trail_history.rb
class PaperTrailHistory < PaperTrail::Version
def self.compose_query(params)
condition = ""
condition <<
(params[:type].present? ? "whodunnit NOT IN (?)" : "whodunnit IN (?)")
condition << " AND object_changes ILIKE '%#{params[:q]}%'" if params[:q].present?
@yorzi
yorzi / GA-form-tracking.js
Created October 13, 2014 14:14
Testing for GA form/event tracking
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-55682644-1', 'auto', {
'allowLinker': true
});
ga('require', 'linker');
@yorzi
yorzi / gist:da7600f1a045d5cf9425
Created July 6, 2015 10:02
bee-run-failed.sh
andy@Andys-Macbook-Pro~/workspace/go.projects/src/github.com/moscn/picoshop(users-and-orders):bee run
2015/07/06 17:50:11 [INFO] Uses 'picoshop' as 'appname'
2015/07/06 17:50:11 [INFO] Initializing watcher...
2015/07/06 17:50:11 [TRAC] Directory(/Users/andy/workspace/go.projects/src/github.com/moscn/picoshop/Godeps/_workspace/src/github.com/astaxie/beego)
2015/07/06 17:50:11 [TRAC] Directory(/Users/andy/workspace/go.projects/src/github.com/moscn/picoshop/Godeps/_workspace/src/github.com/astaxie/beego/cache)
2015/07/06 17:50:11 [TRAC] Directory(/Users/andy/workspace/go.projects/src/github.com/moscn/picoshop/Godeps/_workspace/src/github.com/astaxie/beego/cache/memcache)
2015/07/06 17:50:11 [TRAC] Directory(/Users/andy/workspace/go.projects/src/github.com/moscn/picoshop/Godeps/_workspace/src/github.com/astaxie/beego/cache/redis)
2015/07/06 17:50:11 [TRAC] Directory(/Users/andy/workspace/go.projects/src/github.com/moscn/picoshop/Godeps/_workspace/src/github.com/astaxie/beego/config)
2015/07/06 17:50:11 [TRAC] Dir
@yorzi
yorzi / install_postgresql.sh
Created May 22, 2017 06:54 — forked from dstroot/install_postgresql.sh
Install PostgreSQL on Amazon AMI
#!/bin/bash
###############################################
# To use:
# https://raw.github.com/gist/2776351/???
# chmod 777 install_postgresql.sh
# ./install_postgresql.sh
###############################################
echo "*****************************************"
echo " Installing PostgreSQL"
echo "*****************************************"
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
require 'mina/puma'
set :application_name, 'myapp'
set :domain, 'myapp.com'
set :deploy_to, '/home/admin/myapp'
set :repository, '[email protected]:lnikell/myapp.git'
@yorzi
yorzi / index.html
Created February 17, 2020 08:52 — forked from tiffany352/index.html
Twitter archive browser
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Twitter Archive Browser</title>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/[email protected]/babel.min.js"></script>
<style>