Skip to content

Instantly share code, notes, and snippets.

View benbahrenburg's full-sized avatar

Ben Bahrenburg benbahrenburg

View GitHub Profile
@euforic
euforic / ti.socket.io.js
Created June 5, 2012 17:02
Socket.io-client Titanium
/*! Socket.IO.js build:0.9.6, development. Copyright(c) 2011 LearnBoost <dev@learnboost.com> MIT Licensed */
/**
* Originally Ported to titanium by Jordi Domenech <jordi@iamyellow.net>
* source: https://github.com/iamyellow/socket.io-client
*/
this.io = {};
module.exports = this.io;
/**
@tonylukasavage
tonylukasavage / .project
Created February 3, 2013 11:53
Proper .project file for Alloy in TiStudio, making sure all the right-click wizards for alloy are present
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>g_2tabbed</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.appcelerator.titanium.core.builder</name>
<arguments>
@FokkeZB
FokkeZB / alloy.js
Last active August 13, 2016 17:28
Quick #TiAlloy fix for windows being positioned under the status bar on #iOS7
// For iOS7 only, set the window's top to 20 so they start under the status bar.
Alloy.Globals.windowTop = (OS_IOS && parseInt(Ti.Platform.version[0], 10) >= 7) ? 20 : 0;
@k0sukey
k0sukey / alloy.jmk
Last active December 8, 2016 10:44
Alloy built in underscore.js replace to lo-dash.js put your project folder app/assets/javascript/lodash.underscore.js
task("pre:compile", function(event,logger) {
logger.info('----- PRE:COMPILE -----');
});
task("post:compile",function(event,logger){
logger.info('----- POST:COMPILE -----');
var fs = require('fs'),
path = require('path'),
platform = event.alloyConfig.platform === 'ios' ? 'iphone' : event.alloyConfig.platform; // Resources/iphone
// public interface
@interface UBNTDiscardableThumbnail : NSObject<NSDiscardableContent>
+ (instancetype)discardableThumbnailWithImage:(UIImage *)image;
- (instancetype)initWithImage:(UIImage *)thumbnail;
@property (nonatomic, readonly) UIImage *thumbnail;
@end
@euforic
euforic / app.js
Last active March 15, 2017 14:27
Node.js Libraries for all Titanium platforms | Available Modules [ net, stream (node 9.x version), assert, buffer, util, events ] Still a work in progress
/**
* Available node core libraries
*/
var node = require('node')
, assert = node.assert
, buffer = node.buffer
, events = node.events
, net = node.net
, stream = node.stream
anonymous
anonymous / debounce.swift
Created July 9, 2016 07:54
debounce in Swift 3
func debounce(delay: Int, queue: DispatchQueue, action: (()->()) ) -> ()->() {
var lastFireTime = DispatchTime.now()
let dispatchDelay = DispatchTimeInterval.seconds(delay)
return {
lastFireTime = DispatchTime.now()
let dispatchTime: DispatchTime = lastFireTime + dispatchDelay
queue.after(when: dispatchTime) {
let when: DispatchTime = lastFireTime + dispatchDelay
let now = DispatchTime.now()
@tmspzz
tmspzz / ParameterEncodingExt.swift
Last active October 24, 2017 10:43
Alamofire-GZIP-ParameterEncoding
// Actual gzipping from https://github.com/1024jp/NSData-GZIP
// Example: ParameterEncoding.JSON.gzipped
infix operator • { associativity left }
func • <A, B, C>(f: B -> C, g: A -> B) -> A -> C {
return { x in f(g(x)) }
}
extension ParameterEncoding {
@iosdevzone
iosdevzone / CommonCryptoHack
Created September 21, 2014 03:14
A shell script to write a dummy CommonCrypto.framework module into the directory where playgrounds look for frameworks.
#!/bin/bash
if [[ $BASH_SOURCE != $0 ]]; then echo "$BASH_SOURCE must be executed, not sourced."; return 255; fi
#
# A script to fool iOS playgrounds into allowing access to CommonCrypto
#
# The script creates a dummy CommonCrypto.framework in the SDK's System
# Framework Library Directory with a module map that points to the
# umbrella header
#
# Usage:
@dextorer
dextorer / strip.conf
Created July 6, 2014 13:01
google-play-services-strip-script
actions=true
ads=true
analytics=true
appindexing=true
appstate=true
auth=true
cast=true
common=true
drive=false
dynamic=true