This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 可以 rake secret 生成 | |
export SECRET_KEY_BASE=057c9fbe11080f88f5eb4d56a2e62d725d3bf630a2c5979e91d70a0ddc39a477228c0de47848645df813338a67fbb9bca0902580933b654657257edaea29dc99 | |
export RAILS_ENV=production | |
export RAILS_SERVE_STATIC_FILES=false | |
RAILS_ENV=production rails db:migrate | |
RAILS_ENV=production rails assets:precompile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 理解 async / await | |
// async function 返回的都是promise<pending> | |
// 需要 await 接 promise ,得到的才会是 promise后的值, 但 await 必须要出现在 async 函数中 | |
// 所以 async 函数 可以作为 返回值使用(赋值给一个变量),但仍然需要 在另一个 async函数中 await 后调用 | |
function resolveAfter2Seconds() { | |
return new Promise(resolve => { | |
setTimeout(() => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<select name="lines" id="" onChange="linesOnChange(this)"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# You should look at the following URL's in order to grasp a solid understanding | |
# of Nginx configuration files in order to fully unleash the power of Nginx. | |
# http://wiki.nginx.org/Pitfalls | |
# http://wiki.nginx.org/QuickStart | |
# http://wiki.nginx.org/Configuration | |
# | |
# Generally, you will want to move this file somewhere, and start with a clean | |
# file but keep this around for reference. Or just disable in sites-enabled. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function uuidv4() { | |
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c => | |
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16) | |
) | |
} | |
console.log(uuidv4()); | |
// https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (isAdvancedUpload) { | |
var droppedFiles = false; | |
$form.on('drag dragstart dragend dragover dragenter dragleave drop', function(e) { | |
e.preventDefault(); | |
e.stopPropagation(); | |
}) | |
.on('dragover dragenter', function() { | |
$form.addClass('is-dragover'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Busboy = require('busboy'); | |
var AWS = require('aws-sdk'); | |
var socket = require('socket.io'); | |
var express = require('express'); | |
var http = require('http'); | |
// Set up Express | |
var app = express(); | |
var server = http | |
.Server(app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"manifest_version": 2, | |
"name": "Ad Free Youku", | |
"description": "Watch Youku like a pro", | |
"version": "1.0", | |
"content_scripts": [ | |
{ | |
"matches": ["http://v.youku.com/*"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Module dependencies. | |
*/ | |
var browserSync = require('browser-sync').create() | |
var proxy = require('http-proxy-middleware') // require('http-proxy-middleware'); | |
/** | |
* Configure proxy middleware | |
*/ | |
var jsonPlaceholderProxy = proxy('/api', { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby是完全面向对象的,即使对于某个实际的类也是如此。ruby的任何类,比如Array,或者是任何自己定义的类,都是Class类的实例。 | |
所以,类的静态方法,相当于这个类(或者是Class类的对象)的singleton_methods.也就是说,ruby本质是没有静态方法的。 | |
# ruby 常量,实例变量,类变量,实例方法,类方法(类作为Ruby Class类的实例对象的 单例方法) | |
class Counter | |
DESC = "It is a counter" | |
@@num = 0 | |
def initialize name, num | |
@name = name |