Skip to content

Instantly share code, notes, and snippets.

View coolmenu's full-sized avatar

Coolmenu coolmenu

View GitHub Profile
@coolmenu
coolmenu / gist:3261065
Created August 5, 2012 01:47
python:test
print "hello"
@coolmenu
coolmenu / LinkedTextView.h
Last active August 29, 2015 12:05 — forked from benjaminbojko/LinkedTextView.h
UITextView Subclass to avoid Long-Press Delays with embedded Links
//
// LinkedTextView.h
//
// Created by Benjamin Bojko on 10/22/14.
// Copyright (c) 2014 Benjamin Bojko. All rights reserved.
//
#import <UIKit/UIKit.h>
/**
@coolmenu
coolmenu / gist:6e6e87795b662ef9d4e2
Created November 1, 2015 23:54 — forked from stubailo/gist:a04004c59c8acd4d108a
Proxy HTTP API to Meteor publication and method
// code not guaranteed to work!!!! never ran it
// On the server
Meteor.publish("myData", {
var subscription = this;
var data = HTTP.call("https://reddit.com/r/funny.json").data.children;
data.forEach(function (item) {
subscription.added("my-collection", item);
});
@coolmenu
coolmenu / pom.xml
Created January 22, 2016 00:54 — forked from codahale/pom.xml
Take this and save it as pom.xml in your project directory.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<!-- none yet -->
@coolmenu
coolmenu / README.md
Created March 13, 2016 13:18 — forked from quiver/README.md
Who says PostgreSQL can't Pub/Sub like Redis?

Pub/Sub pattern with PostgreSQL's LISTEN/NOTIFY command

This is a simple chat-like program using pub-sub pattern, backed by PostgreSQL's LISTEN/NOTIFY command.

Publish

publish message to foo channel from user nickname.

$ python pub.py foo nickname
PUBLISH to channel #foo
@coolmenu
coolmenu / routing.js
Created March 20, 2016 14:17 — forked from jamsesso/routing.js
Versioned API routing example
var express = require('express');
var http = require('http');
var app = express();
// Simple user controller implementation.
var users = [
{ username: 'jamsesso', age: 20, gender: 'M' },
{ username: 'bettycrocker', age: 20, gender: 'F' }
];
@coolmenu
coolmenu / 00_destructuring.md
Created May 15, 2016 01:13 — forked from john2x/00_destructuring.md
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors

@coolmenu
coolmenu / Package.swift
Created October 12, 2016 10:47
Swift 3 postgresql
// swift Package.swift
import PackageDescription
let package = Package(
name: "demo-pgsql",
dependencies: [
.Package(url: "https://github.com/PerfectlySoft/Perfect-PostgreSQL.git", majorVersion: 2, minor: 0)
]
)

如果你的iOS项目项目中要使用zmq,那么肯定会涉及到以下问题:

  • Compiling Libzmq as a Universal Static Library for iOS
  • Use Libzmq in project

Step 1)prepare the zeromq sources for iOS

@coolmenu
coolmenu / http_streaming.md
Created November 4, 2016 11:00 — forked from CMCDragonkai/http_streaming.md
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on