Skip to content

Instantly share code, notes, and snippets.

View kosso's full-sized avatar

Kosso kosso

View GitHub Profile
@KsaRedFx
KsaRedFx / encoder.sh
Last active August 29, 2015 14:16
Gource video generation scripts
echo "Starting to encoding process"
mkdir --parents "video/mp4"
for video in complete; do
for speed in fast slow medium; do
file="${video}_${speed}"
echo "Encoding ${file}"
@minhnc
minhnc / app.js
Created February 28, 2012 14:31
Custom Tabs
// Create the tab group
var tabGroup = Titanium.UI.createTabGroup();
// Assign windows & tabs
// IMPORTANT:
// 'tabBarHidden: true' should be set on all windows
// height should be set to 480 - customTabBar's height (change 480 to app screen height)
var win1 = Titanium.UI.createWindow({ title:'Tab 1', height: 440, tabBarHidden: true });
var btn1 = Ti.UI.createButton({title: 'Hide Tabs', height: 40});
win1.add(btn1);
@kosso
kosso / uri.js
Created April 25, 2012 19:27 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@michaelochs
michaelochs / UINavigationBar+iOS7Tint.m
Created September 20, 2013 08:56
Adds -[UINavigationBar setBarTintColor:] and -[UINavigationBar barTintColor] on iOS6 so that you don't have to check for that all the time.
#import <objc/runtime.h>
@implementation UINavigationBar (iOS7Tint)
static void setter(UINavigationBar *self, SEL _cmd, UIColor *tintColor)
{
self.tintColor = tintColor;
}
@abeldomingues
abeldomingues / FileConverter.swift
Last active May 7, 2017 15:57
A Swift adaptation of Chris Adamson's Objective-C code for exporting iPod Library audio tracks (obtained as AVAssets using an MPMediaPickerController) to LPCM. See http://www.subfurther.com/blog/2010/12/13/from-ipod-library-to-pcm-samples-in-far-fewer-steps-than-were-previously-necessary/ for Chris' original post.
import UIKit
import AVFoundation
protocol FileConverterDelegate {
func fileConversionCompleted()
}
class FileConverter : NSObject {
var delegate : FileConverterDelegate?
@cfj
cfj / console.reverselog.js
Last active August 21, 2017 10:00
More console.log sillyness
var _log = console.log;
window.console.log = function(log){
_log.call(console, log.reverse ? log.reverse() : typeof log === 'string' ? log.split('').reverse().join('') : typeof log === 'number' ? log.toString().split('').reverse().join('') : typeof log === 'boolean' ? !log : log);
};
@kosso
kosso / TiFTPSockets.js
Last active August 24, 2017 00:48
FTP binary data file uploader in Titanium using Sockets
/*
// Author : @kosso
// Date : May 10, 2015.
// FTP binary data file uploader. With notes etc. which I cobbled togethr while trying to work out this elusive dark art.
All examples I found were using the 'STOR' command incorrectly and wondering why they were getting empty files appear (if they were lucky).
Also, most if not all were using the deprecated Ti.Network.createTCPSocket() method instead of Ti.Network.Socket.createTCP().
eg : http://stackoverflow.com/questions/23971311/titanium-appcelerator-ftp-upload
@emajcher
emajcher / gist:a2c7a696ae15ae326d50
Created July 21, 2014 16:40
Simple audio waveform display for iPhone using Core Graphics similar to iOS voice memo's app (configured for 320 x 60 display)
//
// WaveformView.m
//
// Created by Edward Majcher on 7/17/14.
//
#import "WaveformView.h"
//Gain applied to incoming samples
static CGFloat kGain = 10.;
@FokkeZB
FokkeZB / shell
Last active October 30, 2017 18:39
Get the Key Hash for Titanium's develoment keystore (replace 3.1.3.GA with your version), required for the Facebook SDK (https://developers.facebook.com/docs/android/getting-started/facebook-sdk-for-android) and the SHA1 fingerprint for the Google Cloud API's (pw: tirocks).
keytool -exportcert -alias androiddebugkey -keystore ~/Library/Application Support/Titanium/mobilesdk/osx/3.1.3.GA/android/dev_keystore | openssl sha1 -binary | openssl base64
keytool -exportcert -alias androiddebugkey -keystore ~/Library/Application\ Support/Titanium/mobilesdk/osx/3.1.3.GA/android/dev_keystore -list -v
@benbahrenburg
benbahrenburg / app.js
Last active February 6, 2018 09:46
Titanium Settings Dialog Examples
Ti.UI.setBackgroundColor('#000');
var alertSettings = require("settings-dialog");
var win = Ti.UI.createWindow({
title:'Example', backgroundColor:'#fff', layout:"vertical"
});
win.add(Ti.UI.createLabel({
text:"Example on now to prompt user to change settings",