Skip to content

Instantly share code, notes, and snippets.

View songjiayang's full-sized avatar
🏃‍♂️
keep going

songjiayang songjiayang

🏃‍♂️
keep going
View GitHub Profile
@songjiayang
songjiayang / node-installer.md
Created October 12, 2013 03:04
how to install latest version nodejs in ubuntu
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
@songjiayang
songjiayang / bootstrap-template.html
Created October 12, 2013 02:59
a bootstrap mini template
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>dianrui &middot; soft</title>

##operation modle (目前这个就处理虚拟货币算了)

txid user_id coin_currcy_id amount status category
@songjiayang
songjiayang / favorite_btn.coffee
Last active December 22, 2015 17:29
a favorite btn
//= require jquery
//= require gigabase
$ = jQuery
class GigaFavoriteBtn
constructor: (element, options) ->
that = this
@$element = $(element)
if options.ajax_init and Gigabase.is_logged()
@songjiayang
songjiayang / active_slider.coffee
Last active December 22, 2015 08:39
使用js 添加 actived link ...
class MessageSidebar
constructor: (element) ->
$element = $(element)
compose_regex = "messages\/new"
inbox_regex = 'messages'
outbox_regex = "messages\/outbox"
archived_regex = "messages\/archived"
trash_regex = "messages\/trash"
if window.location.pathname.match(compose_regex)
@songjiayang
songjiayang / infinitescroll_kaminari.coffee
Created August 23, 2013 04:02
a plugin for infinitescroll with kaminari to auto scroll load page
//= require jquery
//= require gigabase
$ ->
$('.infinitescroll_wrapper').each ->
$wrapper = $(this)
$wrapper.find('.feed-paging nav.pagination').hide()
$wrapper.infinitescroll
navSelector: "nav.pagination"
nextSelector: "nav.pagination .next a"
@songjiayang
songjiayang / gist:6290168
Created August 21, 2013 03:53
rails template..
# 更换源
comment_lines "Gemfile", /source .http.*/
add_source "http://ruby.taobao.org"
# HTML模板
gem 'slim'
# 单点登录
gem 'rubycas-client'
@songjiayang
songjiayang / gist:6156446
Last active December 20, 2015 15:48
notify ..
before_save :set_material_should_change_field
after_save :change_material_attributes
def set_material_should_change_field
option_changed_attributes = self.changed_attributes
@change_field = {}
if self.new_record?
@change_field.merge!( { :price => true, :lead_time => true } )
elsif option_changed_attributes.include?('price_min') || option_changed_attributes.include?('price_max')
@songjiayang
songjiayang / infinitescroll.coffee
Last active December 20, 2015 09:49
a rails code for infinitescroll
coffee:
$wrapper = $('.js-infinitescroll-wrap')
$wrapper.find('.feed-paging nav.pagination').hide()
$wrapper.infinitescroll
navSelector: "nav.pagination"
nextSelector: "nav.pagination .next a"
itemSelector: ".js-infinitescroll-item"
bufferPx: 150
loading:
img: "/assets/spinner.gif"