Skip to content

Instantly share code, notes, and snippets.

View ricardoalcocer's full-sized avatar
💭
making music at https://alcomusic.com

Alco ricardoalcocer

💭
making music at https://alcomusic.com
View GitHub Profile
find-up() {
local path=$(pwd)
while [[ "$path" != "" && ! -e "$path/$1" ]]; do
path=${path%/*}
done
if [ "$path" != "" ]
then
echo "$path"
fi
}
@oroce
oroce / _for iOS users
Created November 2, 2011 18:20
Appcelerator share to native facebook, twitter
This gist is only for Android.
If you would like launch native apps
on iPhone, iPad, you can find information about it in Appcelerator Docs:
-https://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Platform.canOpenURL-method.html
-https://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Platform.openURL-method.html
More info about iOS URL Schemes: http://handleopenurl.com/
@dawsontoth
dawsontoth / tweetView.js
Created February 10, 2011 04:07
Make tweets and links clickable in Titanium Mobile! Here I make a tweet look just like it does on Twitter, and interact the same too.
/**
* Define our parser class. It takes in some text, and then you can call "linkifyURLs", or one of the other methods,
* and then call "getHTML" to get the fully parsed text back as HTML!
* @param text that you want parsed
*/
function Parser(text) {
var html = text;
var urlRegex = /((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi;
@FokkeZB
FokkeZB / app.js
Created August 22, 2013 09:54
How to know if your Android device is LONG or NOTLONG?
http://developer.android.com/guide/topics/resources/providing-resources.html#ScreenAspectQualifier
if ((Ti.Platform.displayCaps.platformWidth / Ti.Platform.displayCaps.platformHeight) < (((Ti.Gesture.orientation === Ti.UI.LANDSCAPE_LEFT)) ? (320 / 240) : (240 / 320)))) {
Ti.API.info('I am LONG');
} else {
Ti.API.info('I am NOTLONG');
}
@dawsontoth
dawsontoth / RecordingVideo.js
Created February 17, 2011 19:43
How to record video, then share or save it. Using Appcelerator Titanium!
/**
* This sample lets you record and share video with Appcelerator Titanium on Android.
* REQUIRES THE 1.6.0 RC OF TITANIUM MOBILE SDK
* http://developer.appcelerator.com/blog/2011/02/release-candidate-for-titanium-mobile-1-6-0.html
*/
/**
* First, create our UI. We'll have two buttons: record, and share.
*/
var win = Titanium.UI.createWindow({
@rampicos
rampicos / social.js
Last active January 10, 2019 10:10
Social.js is the Appcelerator Titanium's Alloy Widget at first it is used to connect with Twitter only, though twitter and linkedin uses OAuth for its authentication I made some changes on Social.js for multi-purpose to connect Twitter and LinkedIn
function hex_sha1(s) {
return binb2hex(core_sha1(str2binb(s), s.length * chrsz));
}
function b64_sha1(s) {
return binb2b64(core_sha1(str2binb(s), s.length * chrsz));
}
function str_sha1(s) {
return binb2str(core_sha1(str2binb(s), s.length * chrsz));
@aaronksaunders
aaronksaunders / InstagramMgr.js
Created September 30, 2012 19:02
Titanium Appcelerator Instagram Code ... This code is almost two years old and I havent tested it in a while
/**
*
* this code was inspired by the work done by David Riccitelli
*
* Copyright 2011 Aaron K. Saunders, Clearly Innovative Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@FokkeZB
FokkeZB / ALLOY.md
Last active February 13, 2019 20:01
Alloy constants and helpers for non-Alloy Titanium projects.

If you want to your CommonJS modules to work in both Alloy and plain Titanium projects, you might need a way to detect if you're in Alloy. For instance, if you're in Alloy you would get Underscore from the alloy-module, while in plain Titanium you would require Underscore directly.

Well, you can:

var _ = require((typeof ENV_TEST === 'boolean') ? 'alloy' : 'underscore')._;

The above works by utilizing Alloy's optimization process. In this process, constants like ENV_TEST will be either TRUE or FALSE. The actual expressions in wich they are used will then be evaluated. If FALSE the code block will be removed. In plain Titanium projects the constants are undefined and this typeof ENV_TEST will be undefined, so the code block will be executed.

@viezel
viezel / app.js
Last active June 15, 2020 19:13
Codebird for Appcelerator Titanium. Using the Twitter API 1.1
// This is an example of use.
// Here we use the new Bearer Token thats make it possible to get tweets without user login
// More info on Bearer here: https://dev.twitter.com/docs/auth/application-only-auth
// Full Codebird API is here: https://github.com/mynetx/codebird-js
var Codebird = require("codebird");
var cb = new Codebird();
cb.setConsumerKey('CONSUMER_KEY', 'CONSUMER_SECRET_KEY');
var bearerToken = Ti.App.Properties.getString('TwitterBearerToken', null);
@FokkeZB
FokkeZB / index.tss
Last active January 16, 2023 09:35
Who said you can't do padding in Titanium (Alloy)?
"#wrapper": {
// Set wrapper to adjust it's size to it's contents
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
// Set stuff like borders and backgrounds on the wrapper
backgroundColor: "red"
}