Skip to content

Instantly share code, notes, and snippets.

View denvers's full-sized avatar
🏎️
Racing

Denver denvers

🏎️
Racing
View GitHub Profile
@FokkeZB
FokkeZB / CROP.md
Created May 2, 2013 09:43
Image (cropping) CommonJS lib for Titanium

Often I need to display a user-provided picture in an ImageView in such a way that the whole ImageView is filled with as much of the picture possible.

This is how I do it:

var image = require('image');

Ti.Media.showCamera({
        mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO],
 success: function (e) {
@FokkeZB
FokkeZB / README.md
Created April 19, 2013 08:59
Setting default unit of measurement.

To make sure your lay-outs look pretty much the same on all devices, including the thousands of different Android resolutions and densities, it's always best to use the 'dp' unit. However, typing '10dp' instead of 10 is quite a pain. A pain you can easily take away by changing the default unit in your tiapp.xml.

/* The Grid ---------------------- */
.lt-ie9 .row { width: 940px; max-width: 100%; min-width: 768px; margin: 0 auto; }
.lt-ie9 .row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; }
.lt-ie9 .row.large-collapse .column,
.lt-ie9 .row.large-collapse .columns { padding: 0; }
.lt-ie9 .row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; }
.lt-ie9 .row .row.large-collapse { margin: 0; }
.lt-ie9 .column, .lt-ie9 .columns { float: left; min-height: 1px; padding: 0 15px; position: relative; }
.lt-ie9 .column.large-centered, .columns.large-centered { float: none; margin: 0 auto; }
<?php
/**
* Fix Gravity Form Tabindex Conflicts
* http://gravitywiz.com/fix-gravity-form-tabindex-conflicts/
*/
add_filter( 'gform_tabindex', 'gform_tabindexer', 10, 2 );
function gform_tabindexer( $tab_index, $form = false ) {
$starting_index = 1000; // if you need a higher tabindex, update this number
if( $form )
add_filter( 'gform_tabindex_' . $form['id'], 'gform_tabindexer' );
exports.definition =
config:
adapter:
type: "rest"
name: "Agent"
extendModel: (Model) ->
_.extend Model::,
url: ->
@dawsontoth
dawsontoth / app.js
Created April 16, 2012 19:36
Pullable Left Menu
var win = Ti.UI.createWindow({
backgroundColor: '#333'
});
var menuWidth = 200;
var container = Ti.UI.createScrollView({
disableBounce: false,
horizontalBounce: true,
contentWidth: Ti.Platform.displayCaps.platformWidth + menuWidth
<?php
// get constants defined by the application
// All constants available
$constants = get_defined_constants(TRUE);
// just constants from the app in question
$app_constants = $constants['user'];
echo '<pre>';