Skip to content

Instantly share code, notes, and snippets.

@julianshen
julianshen / CircleTransform.java
Last active November 6, 2023 12:47
CircleTransform for Picasso
/*
* Copyright 2014 Julian Shen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
package main
import (
"fmt"
"image/jpeg"
"io/ioutil"
"log"
"net/http"
"os"
"path/filepath"
@julianshen
julianshen / merge.go
Created October 23, 2012 16:52
[Go] Concurrent merge sort
package main
import "fmt"
func Merge(ldata []int, rdata []int) (result []int) {
result = make([]int, len(ldata) + len(rdata))
lidx, ridx := 0, 0
for i:=0;i<cap(result);i++ {
switch {
function _strstr(str1, str2){
var i = 0;
for(var c of str2) {
if(str1[i++] != c) {
return false;
}
}
return true;
}
package com.htc.blinkfeed.sample.vimeo.api;
import java.io.IOException;
import java.net.HttpURLConnection;
import oauth.signpost.OAuthConsumer;
import oauth.signpost.basic.DefaultOAuthConsumer;
import oauth.signpost.exception.OAuthCommunicationException;
import oauth.signpost.exception.OAuthExpectationFailedException;
import oauth.signpost.exception.OAuthMessageSignerException;
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"}