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
<template> | |
<div> | |
<label v-if="label" class="form-label" :for="`date-input-${_uid}`">{{ label }}:</label> | |
<input v-bind="$attrs" class="form-input" :id="`date-input-${_uid}`" :class="{ error: error }" type="text" ref="input" :value="value" @change="change" @keyup="change"> | |
<div v-if="error" class="form-error">{{ error }}</div> | |
</div> | |
</template> | |
<script> | |
import pikaday from 'pikaday' |
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
<?php | |
/** | |
* If you have two sets of collections, which you would previously have used a nested foreach to do something to each unique | |
* combination of items, you can use this macro to get it done instead! | |
* | |
* It will return a collection of tuples that represent the combination of the two collections. If you'd like to add keys to the tuple | |
* you can pass that in as an optional second argument! | |
*/ |
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
alias homestead='function __homestead() { (cd ~/Documents/Code/Homestead && vagrant $*); unset -f __homestead; }; __homestead' | |
# Usage | |
homestead up | |
homestead halt | |
# etc... |
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
<?php | |
////////////////////////////////// | |
// Reddit "hot" story algorithm // | |
////////////////////////////////// | |
function hot($ups, $downs, $date) | |
{ | |
if (is_string($date)) $date = strtotime($date); | |
$s = $ups - $downs; |
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
var arr = { | |
max: function(array) { | |
return Math.max.apply(null, array); | |
}, | |
min: function(array) { | |
return Math.min.apply(null, array); | |
}, | |
range: function(array) { |
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( window.devicePixelRatio !== 1 ){ | |
var c = canvas.getElement(); // canvas = fabric.Canvas | |
var w = c.width, h = c.height; | |
// Scale the canvas up by two for retina | |
// just like for an image | |
c.setAttribute('width', w*window.devicePixelRatio); | |
c.setAttribute('height', h*window.devicePixelRatio); |
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
var AWS; | |
var queueName = 'TestQueue110512'; | |
var awsAccountId = Ti.App.Properties.getString('aws-account-id'); | |
function pretty(key, value) { | |
if ((key == 'source') || (key == 'type')) { | |
return undefined; | |
} else { | |
return value; |
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
var DoubleSlider = require('ti.doubleslider/widget'); | |
var win = Ti.UI.createWindow(); | |
var doubleSlider = new DoubleSlider({ | |
top: 50, | |
width: 300, | |
minValue: 0, | |
maxValue: 100, | |
startValue: 30, |
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
var ci_geofencing = require('ci.geofencing'); | |
Ti.API.info("module is => " + ci_geofencing); | |
var regions = [] | |
regions.push({ | |
"title" : "Willis Tower", | |
"latitude" : 41.878844, | |
"longitude" : -87.635942, | |
"radius" : 100 |
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
/* | |
* I made this code for an upcoming hackaton, so, it's really, really ugly. Feel free | |
* to update it here so everyone will be able to use it correctly. | |
* | |
* It's pretty easy to understand, basicly the object you want to edit, an overlay, | |
* four handlers, and the background view. | |
* | |
* It's currently made for/tested on iPad 5.0 with Timob 2.0.2; works only in landscape. | |
* | |
* This code is under the Moustach licence. This means you can do whatever you want with |
NewerOlder