Skip to content

Instantly share code, notes, and snippets.

View artanisdesign's full-sized avatar

Gergely Cziva artanisdesign

View GitHub Profile
@artanisdesign
artanisdesign / jshint
Last active August 29, 2015 14:21
jshint
{
"bitwise": true,
"camelcase": true,
"eqeqeq": true,
"indent": 4,
"unused": true,
"onevar": true,
"undef": true,
"trailing": true,
"latedef": true,
@artanisdesign
artanisdesign / node.sh
Last active August 29, 2015 14:11 — forked from adamcbrewer/node.sh
# This command will make sure the process persists
# even after you log out of a session
node server.js >/dev/null 2>&1 &
function showgallery(){
Titanium.Media.openPhotoGallery({
success:function(event){
var cropRect = event.cropRect;
var image = event.media;
Ti.API.debug('Our type was: '+event.mediaType);
if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO){
var uri = image.nativePath;
@artanisdesign
artanisdesign / jshint_setup.md
Last active December 1, 2015 15:58
Install and setup JSHint Plugin in Titanium / Appcelerator Studio
@artanisdesign
artanisdesign / .jshintrc
Last active July 8, 2016 20:04
Titanium JSHint setup
{
"bitwise": true,
"camelcase": true,
"eqeqeq": true,
"indent": 4,
"unused": true,
"onevar": true,
"undef": true,
"trailing": true,
"latedef": true,
@artanisdesign
artanisdesign / TiUIWindowProxy.m
Created December 25, 2013 22:31
in iOS7, with Titanium, if you set rightNavButton or leftNavButton, with a custom button or view.. etc, it has extra spacing on the left or right side, which is really annoying, if you want the button snap to the edge. here is a small hack, if you need the view positioned to the left or right side correctly.
//from line 502
-(void)setRightNavButton:(id)proxy withObject:(id)properties
{
ENSURE_UI_THREAD_WITH_OBJ(setRightNavButton,proxy,properties);
if (properties == nil) {
properties = [self valueForKey:@"rightNavSettings"];
}
else {
[self setValue:properties forKey:@"rightNavSettings"];
@artanisdesign
artanisdesign / TiUIButton.m
Last active December 19, 2015 22:29
showsTouchWhenHighlighted on Titanium button
-(UIButton*)button
{
if (button==nil)
{
BOOL hasImage = [self.proxy valueForKey:@"backgroundImage"]!=nil;
UIButtonType defaultType = (hasImage==YES) ? UIButtonTypeCustom : UIButtonTypeRoundedRect;
style = [TiUtils intValue:[self.proxy valueForKey:@"style"] def:defaultType];
UIView *btn = [TiButtonUtil buttonWithType:style];
@artanisdesign
artanisdesign / gist:5029161
Created February 25, 2013 11:08
TiModalWindow Anim
//Application Window Component Constructor
function ApplicationWindow() {
//load component dependencies
var FirstView = require('ui/common/FirstView');
//create component instance
var self = Ti.UI.createWindow({
backgroundColor : '#ffffff',
borderRadius : 6
});
@artanisdesign
artanisdesign / gist:4485678
Last active December 10, 2015 20:08
Small hack for Titanium AudioPlayer to handle stream errors!
//..
//AudioStreamer/AudioStreamerCUR.m
//
// failWithErrorCode:
//
// Sets the playback state to failed and logs the error.
//
// Parameters:
// anErrorCode - the error condition
//
Titanium.App.addEventListener("playvideo", function (e) {
win11 = Titanium.UI.createWindow({
orientationModes: [Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT],
title: "Video",
zIndex: 222222
});
var activeMovie = Titanium.Media.createVideoPlayer({
fullscreen: !0,
autoplay: !0,