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
<TextClock
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textClock"
android:textSize="60sp"
android:textColor="#b3b5b5"
android:format24Hour="k"/>
<blink android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextClock
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textClock"
android:textSize="60sp"
android:textColor="#b3b5b5"
android:format24Hour="k"/>
<blink android:layout_width="wrap_content"
android:layout_height="wrap_content">
<blink android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextClock
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textClock"
android:textSize="60sp"
android:textColor="#b3b5b5"/>
</blink>
@julianshen
julianshen / build.gradle
Created June 15, 2013 15:40
Include native lib in gradle
task copyNativeLibs(type: Copy) {
from fileTree(dir: 'jni', include: '**/*.so' ) into 'build/native-libs'
}
tasks.withType(Compile) { compileTask -> compileTask.dependsOn copyNativeLibs }
clean.dependsOn 'cleanCopyNativeLibs'
tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
pkgTask.jniDir file('build/native-libs')
}
package main
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
@julianshen
julianshen / gist:4960582
Created February 15, 2013 14:07
qadb.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
<key>CFBundleIconFile</key>
<string>@ICON@</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/QMake</string>
package main
import (
"fmt"
uuid "github.com/julianshen/GoUUID"
)
func main() {
_uuid, err := uuid.RandomUUID()
@julianshen
julianshen / handler.go
Created November 2, 2012 10:31
[Go] Type, Method, and Interface
type Handler interface {
ServeHTTP(ResponseWriter, *Request)
}
type HandlerFunc func(ResponseWriter, *Request)
// ServeHTTP calls f(w, r).
func (f HandlerFunc) ServeHTTP(w ResponseWriter, r *Request) {
f(w, r)
}
@julianshen
julianshen / d.go
Created October 24, 2012 03:17
[Go] Demo defer
package main
import "fmt"
func deferdemo(n int) {
fmt.Println(n)
defer fmt.Println("a")
fmt.Println("b")