Skip to content

Instantly share code, notes, and snippets.

@wad3g
wad3g / android-l.txt
Last active September 8, 2016 01:15
Android Lollipop Developer Preview Fixes
## Fix Soft Key/Notification Shade Issues
adb shell am start -n com.google.android.setupwizard/.SetupWizardTestActivity
# No SDCard Error
su restorecon -FR /data/media/0
## Enable Double Tap to Wake
echo 1 > /sys/devices/soc.0/f9924000.i2c/i2c-2/2-0070/input/input0/wake_gesture
@wad3g
wad3g / typekit-ss.js
Created September 8, 2016 01:19
Typekit script to use browsers' sessionStorage
<script>
(function(d) {
var tkTimeout=3000;
if(window.sessionStorage){if(sessionStorage.getItem('useTypekit')==='false'){tkTimeout=0;}}
var config = {
kitId: 'mrp7ylq',
scriptTimeout: tkTimeout
},
h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";if(window.sessionStorage){sessionStorage.setItem("useTypekit","false")}},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='//use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)
})(document);
@wad3g
wad3g / loadCSS.js
Created September 8, 2016 01:21
Load CSS async via loadCSS.js
<script>
/*! loadCSS: load a CSS file asynchronously. [c]2016 @scottjehl, Filament Group, Inc. Licensed MIT */
(function(w){
"use strict";
/* exported loadCSS */
var loadCSS = function( href, before, media ){
// Arguments explained:
// `href` [REQUIRED] is the URL for your CSS file.
// `before` [OPTIONAL] is the element the script should use as a reference for injecting our stylesheet <link> before
// By default, loadCSS attempts to inject the link after the last stylesheet or script in the DOM. However, you might desire a more specific location in your document.
@wad3g
wad3g / css-system-font.css
Created September 8, 2016 01:24
CSS to use native system font
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"
@wad3g
wad3g / responsive-font-size.css
Created September 8, 2016 01:46
Adjust font-size based on viewport height and width
/* The type font size in a responsive layout should be able to adjust with each viewport.
You can calculate the font size based on the viewport height and width using :root */
:root {
font-size: calc(1vw + 1vh + .5vmin);
}
/* Now you can utilize the root em unit based on the value calculated by :root */
body {
font: 1em/1.6rem sans-serif;
}
@wad3g
wad3g / margin-top.css
Created September 8, 2016 01:47
Add margin-top to all elements that follow other elements
* + * {
margin-top: 1.5em;
}
@wad3g
wad3g / browser-hacks.css
Created September 8, 2016 01:48
Browser hacks using css selectors and queries
/***** Selector though hack ******/
/* Only for IE6 and below */
* html div { color: gray }
/* Only for IE7 */
*:first-child+html div { color: gray }
@wad3g
wad3g / Default (OSX).sublime-keymap
Created September 8, 2016 01:52
Sublime Text User Key Bindings
[
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" },
{ "keys": ["super+n"], "command": "new_window" },
{ "keys": ["super+t"], "command": "new_file" },
{ "keys": ["super+shift+r"], "command": "reindent"},
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" }
]
@wad3g
wad3g / firechrome.applescript
Created September 8, 2016 01:54
Open Chrome's current tab in Firefox or vice versa
tell application "System Events"
set myFrontMost to name of first item of (processes whose frontmost is true)
end tell
property theURL : ""
if myFrontMost is "Google Chrome" then
tell application "Google Chrome"
set theURL to URL of active tab of window 1
end tell
@wad3g
wad3g / incognito-chrome-canary.applescript
Created September 8, 2016 01:56
Opens a new Incognito Window in Chrome Canary
on alfred_script(q)
tell application "Google Chrome Canary"
activate
tell application "System Events"
keystroke "n" using {command down, shift down}
end tell
end tell