Skip to content

Instantly share code, notes, and snippets.

View tzmartin's full-sized avatar
🏴‍☠️
ahoy!

tz ✨ tzmartin

🏴‍☠️
ahoy!
View GitHub Profile
@tzmartin
tzmartin / README.md
Created February 3, 2015 21:14
React Native README

Warning: This is a one-time code drop to accompany the ReactJS conference talk, and is not accessible outside the official conference attendees - please don't share this code.

This is also a very early alpha release. There are certainly bugs and missing features. Some things may even be well-documented in JS, but missing from the native implementation. We are committed to improving and expanding the capabilities of this project as fast as we can, and look forward to working with the community.

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@tzmartin
tzmartin / sticky-table-headerview.js
Created December 9, 2014 01:53
Titanium Sticky Header
// just a quick n dirty test. See result: http://monosnap.com/file/wT6dJZ4zOrHzjiXi1mhfnIocEZiAWW
var headerView = Ti.UI.createView({
backgroundColor:'#fff',
height:80,
layout:'horizontal'
});
headerView.add(Ti.UI.createButton({title:'$100',left:20,top:13,height:50,width:80,backgroundColor:'#ca3943',borderRadius:4,color:'#fff'}));
headerView.add(Ti.UI.createButton({title:'$500',left:20,top:13,height:50,width:80,backgroundColor:'#ca3943',borderRadius:4,color:'#fff'}));
@tzmartin
tzmartin / anim.js
Last active August 29, 2015 14:09 — forked from guiled/anim.js
// next two from http://stackoverflow.com/a/5624139/292947
function componentToHex(c) {
var hex = c.toString(16);
return hex.length == 1 ? "0" + hex : hex;
}
function rgbToHex(r, g, b) {
return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
}
@tzmartin
tzmartin / titanium_webview_websocket.js
Last active August 29, 2015 14:09
Titanium WebView as a Websocket Processor
module.exports = function(_args) {
/*
This is a simple WebView running as a websocket client. Here are notes:
- To test, run a local socket server (ie, socket.io). Socket.io example chat app: http://socket.io/get-started/chat/
- Pass the websocket URL into io.connect() method
- Event callbacks are registered on Ti.App.. app should fire 'app:ws:connected'. Observe console.log: "Websocket is connected"
- For securty purposes, use inline HTML (string below) to compile into bytecode, rather than filesystem / HTML resources.
@tzmartin
tzmartin / titanium_google_streetview.md
Last active December 16, 2015 20:06
Titanium Google Maps Streetview Hack
Ti.UI.createWebView({
  html:"<html><head><meta name='viewport' content='width=850,user-scalable=no'/><script src='http://maps.google.com/maps/api/js?sensor=false' type='text/javascript'></script></head><body onload=\"new google.maps.StreetViewPanorama(document.getElementById('p'),{position:new google.maps.LatLng("+lat+", "+lon+")});\" style='padding:0px;margin:0px;'><div id='p' style='height:100%;width:100%;'></div></body></html>",
  backgroundColor:'#000',
  width:850,
  height:650
});
@tzmartin
tzmartin / ios.provisioning.md
Last active November 3, 2024 16:49
How To Remove iOS Provisioning Files

You can delete the files directly from ~/Library/MobileDevice/Provisioning Profiles

Open finder, ⌘-Shift-G, and paste in the above path. Restart Xcode afterward.

An alternative way is to use the Apple Configurator (Mavericks) or iPhone Configuration Utility (pre-Mavericks) which displays provisioning profiles installed on your system and allows you to remove them (select and press delete key).

Apple Configurator Apple Configurator makes it easy for anyone to mass configure and deploy iPhone, iPad, and iPod touch in a school, business, or institution.

@tzmartin
tzmartin / tss.window.properties.js
Created November 11, 2014 21:38
Alloy TSS Window Transparency Properties
"Window[platform=ios]": {
// Tell the windowManager this window is part of the NavGroup by default
navGroup: true,
backButtonTitle: '', // No back button title by default
statusBarStyle: Ti.UI.iPhone.StatusBar.LIGHT_CONTENT,
barColor: 'transparent',
translucent: true,
navTintColor: '#fff',
backgroundColor: '#ffffff99', // rgba for transparency
extendEdges: [
@tzmartin
tzmartin / index.xml
Last active August 29, 2015 14:08 — forked from jasonkneen/index.xml
<!-- note the ONLY change to this is the additional module="tabIndicator"
attribute + properties to override indicator defaults //-->
<Alloy>
<TabGroup module="tabIndicator" tabsBackgroundColor="#000" tabIndicatorHeight="1" tabIndicatorColor="white" tabIndicatorWidth="75%">
<Tab title="Tab 1" icon="/images/icons/519-tools-1.png" activeIcon="/images/icons/519-tools-1_active.png" color="#555" activeColor="#fff">
<Window title="Tab 1" barColor="black" navTextColor = "#fff">
<Label onClick="openWin1">Tab 1</Label>
</Window>
</Tab>
<Tab title="Tab 2" icon="/images/icons/516-archive-box.png" activeIcon="/images/icons/516-archive-box_active.png" color="#555" activeColor="#fff">
@tzmartin
tzmartin / Alloy.Model.HTTP.Loop
Created October 22, 2014 18:50
Loop through an HTTP response object and only add new Alloy Models if needed.
/*
Loop through an HTTP response object and only add new Alloy Models if needed.
Assumes `eventId` is the primary key defined in Events.js Model file.
Caution: this snippet is untested
*/
var events = Alloy.createCollection('Events');