Skip to content

Instantly share code, notes, and snippets.

View clathrop's full-sized avatar

Carter Lathrop clathrop

View GitHub Profile
@clathrop
clathrop / datepicker-android
Created July 17, 2012 20:49
Titanium: Date Picker for Android
// This is an example in having a date picker popup and when set, it saves the value to a textfield
var win = Ti.UI.createWindow({
backgroundColor : 'blue',
});
var picker = Ti.UI.createPicker({
});
@clathrop
clathrop / view-overlay-map
Created July 18, 2012 18:27
iOS and Android: Overlaid views on top of maps
var win1 = Ti.UI.createWindow({
backgroundColor : '#fff',
exitOnClose : true,
navBarHidden : true,
//layout : 'vertical'
});
var viewbot = Ti.UI.createView({
});
@clathrop
clathrop / acs-push-example
Last active October 7, 2015 12:27
An example of how to set up everything you need for push notifications.
/* ACS Push Notification Sample
* created by: Carter Lathrop
*
* This is a small sample app on using push notifications. In order to register your device for push notifcations
* there are a couple steps you must take to ensure your device is connected to the cloud. First, a user must
* be logged in. Then push notifications must be enabled, in this app there is a switch to enable/disable it.
* Then a user must subscribe to a channel. A channel is pipeline for sending notifications, designed for a
* way to send notifications through a certain channel so that only people subscribed to the channel "racecar",
* for example, will recieve notifications about racecars. In this example app though, there is only support
* for sending push notifications from the web server, a push from the web will go to all devices that are
@clathrop
clathrop / camera-overlay
Created July 26, 2012 18:49
Titanium: Using a camera overlay and saving images to internal storage
var win = Titanium.UI.createWindow();
var scanner = Titanium.UI.createView({
width : 260,
height : 200,
borderColor : 'red',
borderWidth : 5,
borderRadius : 15
});
@clathrop
clathrop / custom-objects-query
Created August 1, 2012 22:59
Titanium: Create Custom Objects/Query Custom Objects By Descending Order
var Cloud = require('ti.cloud');
var win = Ti.UI.createWindow({
backgroundColor : 'white',
layout : 'vertical'
});
var sv = Ti.UI.createScrollView({
backgroundColor : '#fff',
contentWidth : 300,
@clathrop
clathrop / custom-bottom-tabgroup
Created January 28, 2013 20:46
This is a very simple example of how a custom tab group might be built to use at the bottom of the screen for android.
var win = Titanium.UI.createWindow({
backgroundColor: 'black',
fullscreen: false
});
//-------Views to hold content-------
var winView1 = Ti.UI.createScrollView({
top: 0,
height: '85%',
@clathrop
clathrop / cropped-thumbs
Created April 14, 2015 08:45
cropped square thumbnails with twitter bootstrap & css
<!-- HTML -->
<div class="col-sm-6">
<a href="#" class="thumbnail">
<div class="caption">
title<br/>3 x bekeken
</div>
<div class="image">
<img src="" class="img img-responsive full-width" />
</div>
</a>
@clathrop
clathrop / mvmp3
Last active August 29, 2015 14:23
This nifty script hunts for mp3 files within a specified dir (default is ~/Downloads) and moves them to the "Automatically Add to Itunes" folder in the ITUNES_HOME dir
#!/bin/bash
# This nifty script hunts for mp3 files within a specified dir
# (default is ~/Downloads) and moves them to the "Automatically
# Add to Itunes" folder in the ITUNES_HOME dir
itunesAuto="${ITUNES_HOME}/iTunes Media/Automatically Add to iTunes/"
downloadsDir="${HOME}/Downloads"
files=$(shopt -s nullglob dotglob; echo $downloadsDir/*.mp3)
@clathrop
clathrop / remote_env_profile
Created June 26, 2015 21:06
my default remote bash_profile script
#################################################################################
# Add personal setup here.
# give a nickname to this machine for reference purposes on cli
export HOSTNICK="rd35"
parse_git_branch() {
git branch 2>/dev/null | grep \* | sed -ne 's#\* ##p' | awk -F / '{print " [GIT:"$0 "]"}'
}
@clathrop
clathrop / .exrc
Created July 1, 2015 17:09
The .exrc file gives options for the vi editor, here are the ones I use
set ts=4
set autoindent
set number
set showmode