Skip to content

Instantly share code, notes, and snippets.

View KevinTCoughlin's full-sized avatar

Kevin T. Coughlin KevinTCoughlin

View GitHub Profile
@KevinTCoughlin
KevinTCoughlin / gist:2997921
Created June 26, 2012 18:49 — forked from msluyter/gist:1925069
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
/**
* Process an array of data synchronously.
*
* @param data An array of data.
* @param processData A function that processes an item of data.
* Signature: function(item, i, callback), where {@code item} is the i'th item,
* {@code i} is the loop index value and {@code calback} is the
* parameterless function to call on completion of processing an item.
*/
function doSynchronousLoop(data, processData, done) {
@KevinTCoughlin
KevinTCoughlin / tumblr-oauth-client.js
Last active August 29, 2015 14:06
Tumblr OAuth Client for Windows 8/8.1
(function () {
"use strict";
/**
* Tumblr OAuth Client
*/
WinJS.Namespace.define('TumblrOAuth', {
client: WinJS.Class.define(function (consumerKey, consumerSecret) {
this._consumerKey = consumerKey;
this._consumerSecret = consumerSecret;
@KevinTCoughlin
KevinTCoughlin / themes-debug.xml
Last active September 8, 2015 12:01 — forked from dlew/themes-debug.xml
With the new theming in AppCompat, a lot of assets are tinted automatically for you via theme attributes. That has often led me to wonder "where the hell did this color come from?" You can replace your normal theme with this debug theme to help figure out the source of that color.
<!-- You can change the parent around to whatever you normally use -->
<style name="DebugColors" parent="Theme.AppCompat">
<!-- System colors -->
<item name="android:windowBackground">@color/__debugWindowBackground</item>
<item name="android:colorPressedHighlight">#FF4400</item>
<item name="android:colorLongPressedHighlight">#FF0044</item>
<item name="android:colorFocusedHighlight">#44FF00</item>
<item name="android:colorActivatedHighlight">#00FF44</item>
@KevinTCoughlin
KevinTCoughlin / what-forces-layout.md
Last active September 19, 2015 22:21 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@KevinTCoughlin
KevinTCoughlin / .eslintrc.js
Last active September 21, 2015 14:32 — forked from nkbt/.eslintrc.js
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@KevinTCoughlin
KevinTCoughlin / springer-free-maths-books.md
Created December 28, 2015 23:55 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of maths books available for free, here are the direct links
@KevinTCoughlin
KevinTCoughlin / gist:24a2d96ca1bdb984eeaa
Created January 8, 2016 16:20 — forked from andphe/gist:3232343
Export your links from Safari reading list
/usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | grep -E -o '<string>http[s]{0,1}://.*</string>' | grep -v icloud | sed -E 's/<\/{0,1}string>//g'
@KevinTCoughlin
KevinTCoughlin / angularjs_directive_attribute_explanation.md
Created February 10, 2016 22:24 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@KevinTCoughlin
KevinTCoughlin / get-watchers.js
Created March 3, 2016 01:21 — forked from kentcdodds/get-watchers.js
Get Watchers of element and its children
function getWatchers(root) {
root = angular.element(root || document.documentElement);
var watcherCount = 0;
function getElemWatchers(element) {
var isolateWatchers = getWatchersFromScope(element.data().$isolateScope);
var scopeWatchers = getWatchersFromScope(element.data().$scope);
var watchers = scopeWatchers.concat(isolateWatchers);
angular.forEach(element.children(), function (childElement) {
watchers = watchers.concat(getElemWatchers(angular.element(childElement)));