This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Call the given callback function when the indicated page is loaded | |
# | |
# [Get ready] | |
# | |
# 1. Add data attributes to the body tag in your application layout file. | |
# ex) | |
# <body data-controller="<%= controller_name %>" data-action="<%= action_name %>"> | |
# | |
# 2. Put this file into app/assets/javascripts/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Usage: | |
* var models = [{ attributes: { name: 'Scott' } }, { attributes: { name: 'Tiger' } }]; | |
* deepPluck(models, 'attributes', 'name'); //=> ['Scott', 'Tiger'] | |
*/ | |
var deepPluck = function(array) { | |
var copiedArray = [].concat(array); | |
for (var i = 1; i < arguments.length; i++) { | |
copiedArray = _.pluck(copiedArray, arguments[i]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* $.backboneSortable | |
*/ | |
(function(){ | |
var methods = { | |
init: function(options) { | |
var settings = $.extend({ | |
// defaults | |
}, options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (val date = arguments?.getSerializable(ARG_DATE) as LocalDate) { | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun <T1, T2> safe(t1: T1?, t2: T2?): Pair<T1, T2>? { | |
return if (t1 == null || t2 == null) null else Pair(t1, t2) | |
} | |
fun <T1, T2, T3> safe(t1: T1?, t2: T2?, t3: T3): Triple<T1, T2, T3>? { | |
return if (t1 == null || t2 == null || t3 == null) null else Triple(t1, t2, t3) | |
} | |
// Usage (case in fragments) | |
val (context, activity) = safe(context, activity) ?: return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ex) | |
* <input type="text" class="jq-auto-adjust" data-base-width="60" data-base-window-width="1280"> | |
* $('.jq-auto-adjust').autoAdjust(); | |
*/ | |
(function($) { | |
'use strict'; | |
var methods = { | |
init: function(options) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
EMULATOR=~/Library/Android/sdk/tools/emulator | |
if [ $# -ne 1 ]; then | |
echo "ERROR: Please specify the target AVD from the list below" 1>&2 | |
$EMULATOR -list-avds 1>&2 | |
exit 1 | |
fi | |
$EMULATOR -avd $1 -dns-server "8.8.8.8,8.8.4.4" |
TL;DR
Install Postgres 9.5, and then:
sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- Actions --- | |
$Copy <M-C> | |
$Cut <M-X> <S-Del> | |
$Delete <Del> <BS> <M-BS> | |
$LRU | |
$Paste <M-V> | |
$Redo <M-S-Z> <A-S-BS> | |
$SearchWeb <A-S-G> | |
$SelectAll <M-A> | |
$Undo <M-Z> |
OlderNewer