Skip to content

Instantly share code, notes, and snippets.

View hyongbai's full-sized avatar
💭
Adventuring

hyongbai hyongbai

💭
Adventuring
View GitHub Profile
@hyongbai
hyongbai / sote
Created July 19, 2012 06:56
sote
sote
public class SomeFragment extends Fragment {
MapView mapView;
GoogleMap map;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.some_layout, container, false);
# Copyright: Benjamin Weiss (keyboardsurfer) https://github.com/keyboardsurfer
# Under CC-BY-SA V3.0 (https://creativecommons.org/licenses/by-sa/3.0/legalcode)
# built application files
*.apk
*.ap_
*.jar
!gradle/wrapper/gradle-wrapper.jar
# lint folder
urlencode() {
# urlencode <string>
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:i:1}"
case $c in
[a-zA-Z0-9.~_-]) printf "$c" ;;
*) printf '%%%02X' "'$c"
esac
@hyongbai
hyongbai / node-weather.js
Last active September 16, 2015 07:18 — forked from ydn/node-weather.js
Weather API
var YQL = require('yql');
var query = new YQL('select * from weather.forecast where (location = 94089)');
query.exec(function(err, data) {
var location = data.query.results.channel.location;
var condition = data.query.results.channel.item.condition;
console.log('The current weather in ' + location.city + ', ' + location.region + ' is ' + condition.temp + ' degrees.');
});
#!/system/bin/sh
#Adding insecured adb (adbd)
#Ported to bash script by mattlgroff.
#Dear Chainfire, learn2OpenSource.
su -c 'mount -o remount,rw /'
su -c 'stop adbd'
su -c 'cat /sbin/adbd > /sbin/adbd.original'
su -c 'rm /sbin/adbd'
su -c 'cat /system/usr/adbd > /sbin/adbd'
su -c 'chown 0.0 /sbin/adbd'
```Java
private Bitmap getFullResIcon(String packageName) throws PackageManager.NameNotFoundException {
return getFullResIcon(pm.getApplicationInfo(packageName, 0));
}
private Bitmap getFullResIcon(ApplicationInfo info) {
try {
Resources resources = pm.getResourcesForApplication(info.packageName);
if (resources != null) {
@hyongbai
hyongbai / gist:4c7d9261076a38e1f279a56e7c28ff8d
Last active October 10, 2016 00:44
Instant Run for 20 and lower
如果应用的minSdkVersion小于21,可能多数的Instant Run功能会挂掉,这里提供一个解决方法,通过product flavor建立一个minSdkVersion大于21的新分支,用来debug。
@hyongbai
hyongbai / byte-sizetuts.md
Last active September 28, 2016 07:38 — forked from honkskillet/byte-sizetuts.md
A series of golang tutorials with youtube videos.
@hyongbai
hyongbai / gist:0c9751ac0423b57a4f264cc1309c149e
Created October 10, 2016 00:43
load bitbucket failed for css not reachable, add to pac
".cloudfront.net",
"||cloudfront.net",