Skip to content

Instantly share code, notes, and snippets.

@robflaherty
robflaherty / csv-to-json.php
Created September 1, 2011 02:26
Convert CSV to JSON
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
header('Content-type: application/json');
// Set your CSV feed
@johnhok
johnhok / gist:1197759
Created September 6, 2011 14:51
Caching file uploads on S3 using knox for node.js
var knox = require('knox');
var s3client = knox.createClient({
key: 'KEY GOES HERE',
secret: 'SECRET GOES HERE',
bucket: 'BUCKET NAME GOES HERE'
});
var fileHeaders = {
'Cache-Control': 'public,max-age=290304000'
};
@frne
frne / count_utf8.js
Created November 11, 2011 15:56
Function to count bytes of a string (UTF8)
/**
* Function to fix native charCodeAt()
*
* Now, we can use fixedCharCodeAt("foo€", 3); for multibyte (non-bmp) chars too.
*
* @access public
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/charCodeAt
* @note If you hit a non-bmp surrogate, the function will return false
* @param str String Mixed string to get charcodes
* @param idx Integer Position of the char to get
@mediabounds
mediabounds / floatsign.sh
Last active March 31, 2024 18:43
A small bash script to re-sign iOS applications.
# !/bin/bash
# Copyright (c) 2011 Float Mobile Learning
# http://www.floatlearning.com/
#
# 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
@javan
javan / emoji.m
Created January 10, 2012 02:42
Campfire Emoji
sDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:
// People
@":smile:", @"\ue415",
@":blush:", @"\ue056",
@":smiley:", @"\ue057",
@":relaxed:", @"\ue414",
@":smirk:", @"\ue402",
@":heart_eyes:", @"\ue106",
@":kissing_heart:", @"\ue418",
@pec1985
pec1985 / app.js
Created February 13, 2012 20:13
Lock Screen for iOS apps - Titanium
function PassCode(_params){
_params = _params || {};
// @PARAMS:{
// boxSize: (Number) size of the passcode character boxes
// backgroundColor: (String) background color of the mainview
// backgroundImage: (String) background image of the mainview
// panicColor: (String) background color of the view when panic() is called - when wrong password
// titleText: (String) the text of the title view, above the pass code boxes by default,
// mainView: (Object) params for the main view that hold the passcode boxes
@stevenou
stevenou / GeolocationModule.mm
Created February 14, 2012 21:15
Geofencing in Titanium
// this file located in /Library/Application Support/Titanium/mobilesdk/osx/{version_number}
// add the following methods to GeolocationModule.mm
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
{
NSDictionary *event = [NSDictionary dictionaryWithObjectsAndKeys:NUMBOOL(YES),@"success",[NSDictionary dictionaryWithObjectsAndKeys:NUMDOUBLE(region.center.latitude),@"lat",NUMDOUBLE(region.center.longitude),@"lng",NUMDOUBLE(region.radius),@"radius",region.identifier,@"identifier",nil],@"region",nil];
if ([self _hasListeners:@"enteredRegion"])
{
[self fireEvent:@"enteredRegion" withObject:event];
@raulriera
raulriera / PagingControl.js
Created April 19, 2012 02:13
Custom paging control for scrollableViews for Titanium Appcelerator
// I was unhappy about there was close to no control over the "pageControl"
// in scrollableViews, so I hacked my own
// -----
// Configuration
var pageColor = "#c99ed5";
PagingControl = function(scrollableView){
var container = Titanium.UI.createView({
height: 60
@pec1985
pec1985 / TiUITextAreaProxy.m
Created June 28, 2012 02:30
contentWidth and contentHeight in Ti.UI.TextArea
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2012 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
#ifdef USE_TI_UITEXTAREA
@rborn
rborn / app.js
Created July 5, 2012 15:34 — forked from dawsontoth/app.js
Customize the look of the tab bar in iOS Appcelerator Titanium
Ti.include('overrideTabs.js');
/*
This is a typical new project -- a tab group with three tabs.
*/
var tabGroup = Ti.UI.createTabGroup();
/*
Tab 1.