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 / delay.coffee
Created September 16, 2014 02:52
javascript delay function
delay: ( ->
timer = 0
(callback, ms) ->
clearTimeout timer
timer = setTimeout(callback, ms)
)()
@songjiayang
songjiayang / match.coffee
Created September 15, 2014 06:35
Javascript中如何忽略大小写正则匹配动态字符串。
key_word = "foo"
re = new RegExp(key_word, "i")
"Foo".match(re)
var scrollToTop = function() {
// Get link
var link = $('#scrollUp');
$(window).scroll(function() {
// If the user scrolled a bit (150 pixels) show the link
if ($(this).scrollTop() > 150) {
link.fadeIn(100);
} else {
@songjiayang
songjiayang / codepen.html
Created August 12, 2014 14:41
codepen js
<pre class="codepen" data-height="250" data-type="css" data-href="decHh" data-user="andymcfee" data-safe="true">
<code> </code>
<a href="http://codepen.io/songjiayang/pen/decHh">Check out this Pen!</a>
</pre>
<script src="http://codepen.io/assets/embed/ei.js"> </script>
@songjiayang
songjiayang / html5.html
Last active August 29, 2015 14:05
html5 template
<!DOCTYPE html>
<html lang='zh-CN'>
<head>
<meta charset='utf-8'>
<title>Title is here!</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
</body>
</html>
upstream shellboard_production {
server unix:/var/www/shellboard/shared/tmp/sockets/puma.sock;
}
server {
listen 80;
set $public /var/www/shellboard/current;
server_name www.shellboard.com;
location / {
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@songjiayang
songjiayang / fizz_buzz_whizz.rb
Last active August 29, 2015 14:00
拉勾代码
class FizzBuzzWhizz
def start_game
input_numbers
warp_numbers_with_bingo_message
play
end
private
@songjiayang
songjiayang / backgrid-textarea-cell.coffee
Created January 28, 2014 04:09
this textarea cell supports text area with line breaks ..
jQuery ($)->
_.extend Backgrid.Command.prototype, {
save: () ->
!@shiftKey && @keyCode is 13
moveUp: () ->
@shiftKey && @keyCode is 38