Skip to content

Instantly share code, notes, and snippets.

View xyhp915's full-sized avatar
😇
monadic life ...

Charlie xyhp915

😇
monadic life ...
View GitHub Profile
@xyhp915
xyhp915 / hello
Created April 3, 2014 08:59
hello
hello gist :)
update it .. :)
type Message struct {
Value string
}
func MakeElastic() (<-chan Message, chan<- Message) {
input := make(chan Message, 64)
output := make(chan Message, 64)
middle := make(chan []Message, 1)
@xyhp915
xyhp915 / main.go
Created April 3, 2014 14:42
go play
package main
import (
"fmt"
)
func main() {
queue := []int{1, 2, 3, 4, 5}
@xyhp915
xyhp915 / es.php
Created May 6, 2014 03:34
elasticsearch test
<?php
/* Elasticsearch pinyin index setting */
$index->create( array(
"analysis" => array(
"analyzer" => array(
"hl_pinyin_analyzer" => array(
"tokenizer" => "my_pinyin",
"filter" => array("standard","my_ngram_tokenizer"),
),

OS X 10.10 Guide

Here's what I did to get things working.

1. Install Xcode 6

Yep, over at: https://developer.apple.com

2. Install the Command Line Tools (CLT)

// Framework grid generation
//
// Used only by Bootstrap to generate the correct number of grid classes given
// any value of `@grid-columns`.
.make-grid-columns() {
// Common styles for all sizes of grid columns, widths 1-12
.col(@index) { // initial
@item: ~".col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}";
.col((@index + 1), @item);
@xyhp915
xyhp915 / AF_Upload.m
Created January 8, 2015 08:08
IOS AF Upload
//AF Upload
UIImage *image = [UIImage imageNamed:@"1.png"];
NSData *dataImage = UIImageJPEGRepresentation(image, 1.0);
AFHTTPRequestOperationManager *manage = [AFHTTPRequestOperationManager manager];
[manage POST:User_Image parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
[formData appendPartWithFileData:dataImage name:@"file" fileName:@"1.png"mimeType:@"image/jpeg"];
} success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSString *str = [responseObject objectForKey:@"msg"];
NSLog(@"%@",str);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
# usage: `python ~/Desktop/contours.py 1994-654-12_v02.tif`
# output is to a squareless.txt file and the directory "out"
# Working well with thumbnails with 400px as their longest side - untested with other dimensions
# for i in $(ls -1 | grep tif); do python /Users/artsyinc/Documents/resistance/experiments/artwork_image_cropping/contours.py $i; done
import cv2
import numpy as np
from matplotlib import pyplot as plt
import sys
@xyhp915
xyhp915 / scrollTo.js
Created February 7, 2015 08:40
scrollTo animate
//scrollTop
function scrollTo(element, to, duration) {
var start = element.scrollTop,
change = to - start,
currentTime = 0,
increment = 20;
var animateScroll = function(){
currentTime += increment;
var val = Math.easeInOutQuad(currentTime, start, change, duration);
@xyhp915
xyhp915 / main.js
Created March 14, 2015 16:53
For Zili homework
//implements it for Zili
(function(data){
// console.log(data)
var AggregationData = {} // 用字面量创建一个空对象
var len = data.length
for( var i = 0, item, barcode; i<len ; i++ ){