Skip to content

Instantly share code, notes, and snippets.

/**
* Create an input for a date that gets filled in by a datepicker in a modal window.
*/
createModalDatePickerInput: function(){
var field = Ti.UI.createTextField({
width: '90%',
height: 35,
borderStyle: Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
});
/**
* Create an input for a date that gets filled in by a datepicker in a modal window.
*/
createModalDatePickerInput: function(){
var field = Ti.UI.createTextField({
width: '90%',
height: 35,
borderStyle: Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
});
@abuisman
abuisman / etc_init.d_unicorn_example.co.uk
Created October 28, 2011 06:51 — forked from scottlowe/etc_init.d_unicorn_example.co.uk
Ruby on Rails server setup on Ubuntu 11.04 with Nginx, Unicorn, Rbenv
#! /bin/bash
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the unicorn web server
# Description: starts unicorn
#Inside Photo model
has_attached_file :file,
:processors => [ :blurplates, :thumbnail ],
:styles => { :frontpage => "460x100000", :view => "740x100000", :medium => '300x300', :thumb => "100x100>" }
#blurplates.rb
# Load libs
require 'camellia'
@abuisman
abuisman / gist:1478970
Created December 14, 2011 22:54
Errors getting
["/Users/Achilleas/Sites/rodex/app/assets/images", "/Users/Achilleas/Sites/rodex/app/assets/javascripts", "/Users/Achilleas/Sites/rodex/app/assets/stylesheets", "/Users/Achilleas/Sites/rodex/vendor/assets/javascript", "/Users/Achilleas/Sites/rodex/vendor/assets/markitup", "/Users/Achilleas/Sites/rodex/vendor/assets/stylesheets", "/Users/Achilleas/Sites/rodex/vendor/assets/twitter-bootstrap", "/Library/Ruby/Gems/1.8/gems/jquery-rails-1.0.16/vendor/assets/javascripts"]
@abuisman
abuisman / app_concerns_AssetChild.rb
Created December 15, 2011 22:49
Problem with :name of child
module AssetChild
# by defining a module this should allow us to make nice code which adds:
#
# - has_one :assets
# - adds an after_create hook which automaticly builds the asset.
# - at some latter point we can also add after_update - to update the asset it's timestamp.
# - give access to asset attributes such as name => @usecase.name instead of @usecase.asset.name
#
# -> http://weblog.jamisbuck.org/2007/1/17/concerns-in-activerecord
@abuisman
abuisman / typography.sass
Created May 9, 2012 22:15
Mixin for responsive (relative) font-sizes depending on the screen size using media queries.
/*
Mixin for responsive (relative) font-sizes depending on the screen size using media queries.
This is width based, but you can easily adjust it for more complex, or simple, checking.
Set the base as you max size, then I divided everything into tenths of the base.
To use, simply include the mixin, passing it the font-size that you'd want to see at 100%.
This should then scale nicely along in tenths. If you need more detail, just add more elements to the level list.
@abuisman
abuisman / Templater.coffee
Created May 15, 2012 18:15
A modular (AMD) template file loader for for example underscore.js
/*
A modular (AMD) template file loader for for example underscore.js.
You can use the templater to load up html files as a string in order to use them as templates
for your client side javascript templating.
Pay notice to the 'base_path'. Set this to where your templates reside. The path below is
assuming a Rails application.
You could also not use the base path and just pass it in fully every time.
@abuisman
abuisman / gist:2863979
Created June 3, 2012 15:58
Some example of Backbone and AMD for SO question
// file: models/Task.js
define([], function(){
var Task = Backbone.Model.extend({
//do stuff
});
return Task;
});
@abuisman
abuisman / gist:3706756
Created September 12, 2012 13:54
Some implementation of 'customers who bought this also bought'
// Source: http://www.ubercart.org/contrib/2972
<?php
function RiffTrax_uc_cart_view_form($form) {
drupal_add_css(drupal_get_path('module', 'uc_cart') .'/uc_cart.css');
$output = '<div id="cart-form-products">'
. tapir_get_table('uc_cart_view_table', $form) .'</div>';
if ((