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
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
class NonScrollListView : ListView { | |
constructor(context: Context) : super(context) | |
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) | |
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) | |
init { | |
isVerticalScrollBarEnabled = false | |
isHorizontalScrollBarEnabled = false | |
} |
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
/** | |
* $.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
/** | |
* 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
DELIMITER // | |
CREATE PROCEDURE プロシージャ名() | |
BEGIN | |
-- DECLARE 変数 | |
-- DECLARE CURSOR | |
DECLARE EXIT HANDLER FOR SQLEXCEPTION, SQLWARNING | |
BEGIN | |
GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE, @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT; |
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" |
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/ |