Skip to content

Instantly share code, notes, and snippets.

Julian Shen julianshen

Block or report user

Report or block julianshen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View strstr.js
function _strstr(str1, str2){
var i = 0;
for(var c of str2) {
if(str1[i++] != c) {
return false;
}
}
return true;
}
View primegen.js
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++) {
View ViewController.swift
//
// ViewController.swift
// mapanitest
//
// Created by Julian Shen on 2016/10/4.
// Copyright © 2016年 cowbay.wtf. All rights reserved.
//
import UIKit
import MapKit
View bgrab.go
package main
import (
"crypto/md5"
"encoding/json"
"errors"
"fmt"
"io"
"log"
"regexp"
View grabkeyword.go
package main
import (
"fmt"
"github.com/SlyMarbo/rss"
"github.com/julianshen/go-readability"
"github.com/parnurzeal/gorequest"
"github.com/yanyiwu/gojieba"
)
View 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 Oct 4, 2015
Array Extension
View a.swift
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
}
}
View json_decode_test2.go
package main
import (
"encoding/json"
"fmt"
"os"
)
func main() {
type User struct {
View json_decode_test1.go
package main
import (
"encoding/json"
"fmt"
"os"
)
func main() {
type User struct {
View gist:0c85f482caac64ed26b7
Intent intent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "test");
PackageManager pm = getPackageManager();
ApplicationInfo youtube = null;
ApplicationInfo plus = null;
ApplicationInfo map = null;
try {
youtube = pm.getApplicationInfo("com.google.android.youtube", PackageScanIntentService.FLAGS_PACKAGE);
You can’t perform that action at this time.