Skip to content

Instantly share code, notes, and snippets.

View kosso's full-sized avatar

Kosso kosso

View GitHub Profile
@kosso
kosso / app.js
Last active December 23, 2015 04:59
Fun with Ti.UI.iOS.NavigationWindow !
/*
Fun with NavigationWindow!
creates random coloured windows which create buttons which create random coloured windows which create buttons which...
you get the picture ;)
Required : Titanium SDK 3.1.3 or higher.
Kosso
@kosso
kosso / gist:6584687
Created September 16, 2013 18:40
test for NappDrawer containing a scrollView and a swipeable view.
var NappDrawerModule = require('dk.napp.drawer');
function createAPIExampleWindow(){
var win = Ti.UI.createWindow({
barColor:"#996633",
fullscreen:false,
translucent:false,
statusBarStyle:Ti.UI.iPhone.StatusBar.LIGHT_CONTENT,
navTintColor:'white'
-(NSString*)getNormalizedPath:(NSString*)source
{
// NOTE: File paths may contain URL prefix as of release 1.7 of the SDK
if ([source hasPrefix:@"file:/"]) {
NSURL* url = [NSURL URLWithString:source];
return [url path];
}
// NOTE: Here is where you can perform any other processing needed to
// convert the source path. For example, if you need to handle
@kosso
kosso / responsive.html
Created November 30, 2013 20:14
A simple responsive page layout for something..
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />
<meta name="viewport" content="width=device-width initial-scale=1.0 maximum-scale=1.0 user-scalable=yes" />
<title>responsive testing</title>
<style>
@kosso
kosso / MediaModule.m
Created January 18, 2014 05:45
Titanium SDK experimental hack to enable picking animated gifs from the camera roll. Provides 'event.gifmedia' in the success event. (Look for the 'kosso' comments)
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2010 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.
*/
#ifdef USE_TI_MEDIA
#import "MediaModule.h"
#import "TiUtils.h"
@kosso
kosso / DARPA Open Catalog
Created February 5, 2014 11:57
A list of all DARPA-funded Open Source repos
http://www.darpa.mil/OpenCatalog/index.html
# Add multimedia source
echo "deb http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list
echo "deb-src http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list
apt-get update
apt-get install deb-multimedia-keyring # if this aborts, try again
apt-get update
# Go to local source directory
cd /usr/local/src
@kosso
kosso / gist:2a95f4e27969c7e8dc5e
Created September 29, 2014 16:34
Point in Polygon JS
// untested..
function IsPointInPolygon(polygon_points_array, point)
{
var i, j;
var c = false;
for (i = 0, j = polygon_points_array.length - 1; i < polygon_points_array.lengtht; j = i++)
{
if ((((polygon_points_array[i].lat <= point.lat) && (point.lat < polygon_points_array[j].lat))
@kosso
kosso / qtrotate.py
Created December 14, 2014 17:35
Python script for detecting Quicktime movie rotation - also provides ability to set the rotation atom
#!/usr/bin/env python
"""
QT Rotate
=========
Detect Rotated Quicktime/MP4 files. This script will spit out a rotation
angle if one can be found. It can also write an new rotation angle.
NOTE that translation info will be LOST if a new rotation angle is written.
@kosso
kosso / gist:bc081f99da6585e85476
Last active August 29, 2015 14:19
useful gif thing
-(void)createGIF:(id)args
{
//NSURL *filename = [NSURL URLWithString:[args objectAtIndex:0]];
NSString *filename = [args objectAtIndex:0];
NSArray *images = [args objectAtIndex:1];
float delay = [TiUtils floatValue:[args objectAtIndex:2]];