Skip to content

Instantly share code, notes, and snippets.

View lzyzsd's full-sized avatar
:octocat:

Young for you lzyzsd

:octocat:
  • Open Source
  • singapore
View GitHub Profile
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
import java.lang.reflect.Type;
import java.util.List;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
public class MapData {
private int id;
private String city;
private String street;
/**
*
* Here's a thing that will look through all the text nodes of a document, and
* upon encountering an emoji codepoint, will replace it with an image.
* For now, those images are pulled from GitHub, which isn't very nice, so I
* need to find a more suitable host.
*
* Much of this code was gleaned from staring at the minified GitHub JS.
*
* Copyright (c) 2013 Mark Wunsch. Licensed under the MIT License.
@lzyzsd
lzyzsd / client.js
Created December 4, 2013 01:30 — forked from aelaguiz/client.js
var ChatRoom = function ChatRoom(chatList, inputArea, list) {
var _chatList = chatList,
_inputText = inputArea,
_userList = list,
_nickList = [];
/*
* Handle three events from the communications layer
*/
this.expose = {
@lzyzsd
lzyzsd / .bowerrc
Created November 18, 2013 01:41 — forked from facultymatt/.bowerrc
{
"directory": "components"
}
authRouteProvider.$inject = ['$routeProvider'];
function authRouteProvider ($routeProvider) {
/**
* Creates a controller bound to the route, or wraps the controller in param
* so the authentication check is run before the original controller is executed
* @param currentController
* @return {Function} The wrapper controller
*/
function redirectCtrlFactory (currentController) {
_ctrl.$inject = ['currentUser__', 'userRole__', '$location'];
@lzyzsd
lzyzsd / gist:7020717
Last active December 25, 2015 18:29 — forked from seansullivan/gist:4507044
allowCrossDomain middleware for expressjs or compundjs
#CORS middleware
allowCrossDomain = (req, res, next) ->
res.header 'Access-Control-Allow-Origin', '*'
res.header 'Access-Control-Allow-Methods', 'OPTIONS,GET,PUT,POST,DELETE'
res.header 'Access-Control-Allow-Headers', 'Content-Type, X-Requested-With'
next()
# Cut off OPTIONS requests and just send true as response
handleOptionsMethod = (req, res, next) ->
return res.send(200) if req.method == 'OPTIONS'
Highcharts.Chart.prototype.callbacks.push(function(chart) {
var hasTouch = hasTouch = document.documentElement.ontouchstart !== undefined,
mouseTracker = chart.tracker,
container = chart.container,
mouseMove;
mouseMove = function (e) {
// let the system handle multitouch operations like two finger scroll
// and pinching
if (e && e.touches && e.touches.length > 1) {

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt

Min Streams Interface Spec

This spec describes a minimal stream interface meant for protocol implementors. Modules written to the interfaces in this spec can be used by a wide variety of projects. The protocols will not need any extra dependencies themselves. It's just an interface to implement.

Simple Stream

A simple stream is just a function. It represents a pull-stream. It has the following signature:

// Implementing a stream.