Skip to content

Instantly share code, notes, and snippets.

@Androguide
Androguide / xperia_z1_updates.js
Created October 19, 2013 12:08
Bookmarklet to check for Xperia Z1 Software updates
(function() {
var api = "http://fuas.sonymobile.com/fuas/services/updates?clientName=PCC&clientVersion=3.0&lang=en-US&model=<YOUR_MODEL>&devId=<YOUR_IMEI>&tac_mc=<FIRST_8_D IGITS_OF_IMEI>&swId=1272-6084&swVer=14.1.G.1.534&fsVariant=GLOBAL-HSPA&cdfId=1277-2364&cdfVer=R5A&buildVariant=USER&clientCertType=live&updateFormat=delta,image&channel=cable";
var model = prompt("Enter your device model (C6902 or C6903)");
var imei = prompt("Enter your device's IMEI number");
var url = api.replace("<YOUR_MODEL>", model)
.replace("<YOUR_IMEI>", imei)
.replace("<FIRST_8_D IGITS_OF_IMEI>", imei.substring(0, 8));
window.location = url;
});
@Androguide
Androguide / helper-generator.js
Created November 4, 2013 17:07
Function to generate a set of css helper classes. Example: generateHelper("margintop", "margin-top", 50); will generate a set of margintopX & margintop-X classes which will set margin-top to positive and negative increments of 5px.
function generateHelper(keyword, property, max) {
for (var i = 5; i <= 50; i+=5) {
console.log(keyword + i + " {" + property + ": " + i + "px; }");
console.log(keyword + "-" + i + " {" + property + ": -" + i + "px; }");
}
}
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;
@Androguide
Androguide / designMode.js
Last active December 28, 2015 12:09
WYSWYG website editor bookmarklet : Editor
document.body.contentEditable = 'true';
document.designMode = 'on';
void 0;
@Androguide
Androguide / wyswyg_saver.js
Created November 18, 2013 09:50
WYSWYG website editor bookmarklet : Saver
document.body.contentEditable = 'false';
document.designMode = 'off';
var content = document.documentElement.outerHTML;
document.body.innerHTML = "<br><br><br><br><center><button style='width: 50%; font-size: 1.7em; background-color: #3f9fe0; color: #fff' onclick='generate()'>Your HTML</button></center>";
function generate() {
document.location = "data:text/json," + escape(content);
}
@Androguide
Androguide / gist:7872884
Created December 9, 2013 14:19
Remove blue overlay in the Android WebView when a button/link is clicked, in order to let the CSS handle the pressed state.
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
@Androguide
Androguide / cm_rhine_honami_row_defconfig
Last active January 1, 2016 09:39
msm8974 kernel defconfig for Ubuntu Touch on honami (Sony Xperia Z1)
# CONFIG_ARM_PATCH_PHYS_VIRT is not set
CONFIG_EXPERIMENTAL=y
CONFIG_LOCALVERSION="-perf"
CONFIG_KERNEL_LZO=y
CONFIG_SYSVIPC=y
CONFIG_AUDIT=y
CONFIG_RCU_FAST_NO_HZ=y
CONFIG_IKCONFIG=y
CONFIG_CGROUPS=y
CONFIG_CGROUP_DEBUG=y
@Androguide
Androguide / 51-android.rules
Created January 15, 2014 21:42
Linux udev rules for adb & fastboot protocols on a variety of vendors and devices (location: /etc/udev/rules.d/51-android.rules)
#Lenovo
SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666", OWNER="androguide"
#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666", OWNER="androguide"
#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666", OWNER="androguide"
#NEC
@Androguide
Androguide / boilerplate.sh
Last active January 4, 2016 02:39
Bash boilerplate for coloured scripts and checking for passed arguments
#!/bin/bash
CYAN="\\033[1;36m"
GREEN="\\033[1;32m"
YELLOW="\\E[33;44m"
RED="\\033[1;31m"
RESET="\\e[0m"
MODE='blah'
if [ -z "$1" ]
@Androguide
Androguide / external-cherry-pick.sh
Created January 27, 2014 19:58
Git one-liner to cherry-pick a commit from another repo
git --git-dir=../other/repo/path/.git \
format-patch -k -1 --stdout <commit SHA> | \
git am -3 -k