Skip to content

Instantly share code, notes, and snippets.

View aarondfrancis's full-sized avatar

Aaron Francis aarondfrancis

View GitHub Profile
@rightson
rightson / app.js
Created December 15, 2011 12:15 — forked from skypanther/app.js
Draw gridlines in a Titanium window
// implement like this:
var window = Ti.UI.createWindow({
backgroundColor:'#fff'
});
// draw the gridlines first so your other elements stack on top of them
// without requiring you to set the z-index property of each
var grid = require('gridlines');
grid.drawgrid(10,window);
@IvanMathy
IvanMathy / gist:2863986
Created June 3, 2012 15:59
A simple Drag, Drop and Resize for Titanium Mobile. (@Thedeejay92 - Mousta.ch )
/*
* 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
@aaronksaunders
aaronksaunders / app.js
Created November 1, 2012 13:37
Quick Example a basic IOS Module for Appcelerator Titanium to demonstrate geofencing
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
@pec1985
pec1985 / app.js
Created November 1, 2012 22:11
Double Slider
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,
@mschmulen
mschmulen / app.js
Created November 13, 2012 19:08
aws queu
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;
@paulkaplan
paulkaplan / retina_fabric.js
Created July 21, 2013 22:47
Getting fabric.js to work with Retina screens
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);
@taylorotwell
taylorotwell / global-homestead.sh
Created September 23, 2015 21:40
Global Homestead Without Composer
alias homestead='function __homestead() { (cd ~/Documents/Code/Homestead && vagrant $*); unset -f __homestead; }; __homestead'
# Usage
homestead up
homestead halt
# etc...
<?php
//////////////////////////////////
// Reddit "hot" story algorithm //
//////////////////////////////////
function hot($ups, $downs, $date)
{
if (is_string($date)) $date = strtotime($date);
$s = $ups - $downs;
@stephenfeather
stephenfeather / analytics.js
Created June 2, 2012 18:09
commonJS version of Roger Chapman's Google Analytics Library for Appcelerator's Titanium Mobile SDK
/*
The MIT License
Copyright (c) 2010 Roger Chapman
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@reinink
reinink / DateInput.vue
Created August 27, 2019 11:51
Pikaday Vue Component
<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'