I've been trying to understand how to setup systems from
the ground up on Ubuntu. I just installed redis
onto
the box and here's how I did it and some things to look
out for.
To install:
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Update 7 Oct 2010: | |
# - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
# the WebSocket protocol implementation in the cramp gem does not work | |
# well with Chrome's (newer) WebSocket implementation. | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
var data = "do shash'owania"; | |
var crypto = require('crypto'); | |
crypto.createHash('md5').update(data).digest("hex"); |
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}' |
// Declare the color as RGB; SASS will treat this as hex | |
$green: rgb(27,224,63); | |
// Declare an alpha | |
$alpha: .5; | |
// Declare another color variable as a color with an alpha | |
$greenAlpha: rgba($green, $alpha); | |
body { | |
/* As RGB (which SASS actually ouputs as HEX) */ | |
background: $green; |
// -------------------------------------------------- | |
// Flexbox LESS mixins | |
// The spec: http://www.w3.org/TR/css3-flexbox | |
// -------------------------------------------------- | |
// Flexbox display | |
// flex or inline-flex | |
.flex-display(@display: flex) { | |
display: ~"-webkit-@{display}"; | |
display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox |
Secure sessions are easy, but not very well documented. | |
Here's a recipe for secure sessions in Node.js when NginX is used as an SSL proxy: | |
The desired configuration for using NginX as an SSL proxy is to offload SSL processing | |
and to put a hardened web server in front of your Node.js application, like: | |
[NODE.JS APP] <- HTTP -> [NginX] <- HTTPS -> [PUBLIC INTERNET] <-> [CLIENT] | |
Edit for express 4.X and >: Express no longer uses Connect as its middleware framework, it implements its own now. |
var cv = document.getElementById('cv'); | |
var c = cv.getContext('2d'); | |
var txtDiv = document.getElementById('txt'); | |
var fileBtn = document.getElementById("up-button"); | |
var img = new Image(); | |
img.src = 'a.jpg'; | |
img.onload = init; // 图片加载完开始转换 | |
fileBtn.onchange = getImg; | |
// 根据灰度生成相应字符 |
var gulp = require('gulp'); | |
var gutil = require('gulp-util'); | |
var express = require('express'); | |
var path = require('path'); | |
var tinylr = require('tiny-lr'); | |
var createServers = function(port, lrport) { | |
var lr = tinylr(); | |
lr.listen(lrport, function() { | |
gutil.log('LR Listening on', lrport); |
// -------------------------------------------------- | |
// Flexbox LESS mixins | |
// The spec: http://www.w3.org/TR/css3-flexbox | |
// -------------------------------------------------- | |
// Flexbox display | |
// flex or inline-flex | |
.flex-display(@display: flex) { | |
display: ~"-webkit-@{display}"; | |
display: ~"-moz-@{display}"; |