Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"image/jpeg"
"io/ioutil"
"log"
"net/http"
"os"
"path/filepath"
function _strstr(str1, str2){
var i = 0;
for(var c of str2) {
if(str1[i++] != c) {
return false;
}
}
return true;
}
function isPrime(n) {
if(isNaN(n) || !isFinite(n) || n%1 || n<2) {
return false;
}
if(n%2==0) return (n==2);
if(n%3==0) return (n==3);
var m = Math.sqrt(n);
for(var i = 5 ; i < m; i++) {
//
// ViewController.swift
// mapanitest
//
// Created by Julian Shen on 2016/10/4.
// Copyright © 2016年 cowbay.wtf. All rights reserved.
//
import UIKit
import MapKit
package main
import (
"crypto/md5"
"encoding/json"
"errors"
"fmt"
"io"
"log"
"regexp"
package main
import (
"fmt"
"github.com/SlyMarbo/rss"
"github.com/julianshen/go-readability"
"github.com/parnurzeal/gorequest"
"github.com/yanyiwu/gojieba"
)
@julianshen
julianshen / test_push.go
Created February 24, 2016 16:56
test_push.go
package main
import (
"fmt"
"github.com/alexjlockwood/gcm"
)
func main() {
// Create the message to be sent.
data := map[string]interface{}{"push_id": "10131233", "time": "2016-02-23T06:43:13.265Z", "data": "{'title':'test'}"} regIDs := []string{"device-token-y5g"}
@julianshen
julianshen / a.swift
Last active October 4, 2015 15:41
Array Extension
extension CollectionType where Generator.Element == String {
func find(subString:Generator.Element) -> Int {
for (i,s) in self.enumerate() {
if s.containsString(subString) {
return i
}
}
return -1
}
}
package main
import (
"encoding/json"
"fmt"
"os"
)
func main() {
type User struct {
package main
import (
"encoding/json"
"fmt"
"os"
)
func main() {
type User struct {