Skip to content

Instantly share code, notes, and snippets.

@iotashan
iotashan / square-it.js
Created August 23, 2021 23:00
script to change the canvas size to square, making the extra space black
doc = app.activeDocument;
// change the color mode to RGB. Important for resizing GIFs with indexed colors, to get better results
doc.changeMode(ChangeMode.RGB);
// Makes the default background white
var black = new SolidColor();
white.rgb.hexValue = "000000";
app.backgroundColor = black;
@iotashan
iotashan / buddybuild_postbuild.sh
Created December 8, 2017 15:31
BuddyBuild script that uploads source maps to BugSnag
#!/usr/bin/env bash
APP_NAME="myapp"
BUGSNAG_KEY="123456"
APP_VER=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$BUDDYBUILD_PRODUCT_DIR/Release-iphoneos/$APP_NAME.app/Info.plist")
COMMIT_MSG="$(git log --format=oneline -n 1)"
echo -e "$APP_VER $COMMIT_MSG"
if [[ "$BUDDYBUILD_BRANCH" =~ "master" ]] || [[ "$BUDDYBUILD_BRANCH" =~ "staging" ]] || [[ "$BUDDYBUILD_BRANCH" =~ "development" ]]; then
@iotashan
iotashan / buddybuild_postbuild.sh
Created July 11, 2017 14:55
BuddyBuild post build script for uploading source map and dsym to BugSnag
echo "$BUDDYBUILD_BRANCH branch, preparing for BugSnag..."
echo "generating sourcemap"
cd $BUDDYBUILD_WORKSPACE
react-native bundle --platform ios --entry-file index.ios.js --dev false --bundle-output ./ios/main.jsbundle --sourcemap-output ./ios/main.jsbundle.map
echo -e "\n[BugSnag] Uploading sourcemap\n"
curl https://upload.bugsnag.com/ -F apiKey=$BUGSNAG_KEY -F appVersion=$APP_VER -F minifiedUrl="main.jsbundle" -F sourceMap=@$BUDDYBUILD_WORKSPACE/ios/main.jsbundle.map -F minifiedFile=@$BUDDYBUILD_WORKSPACE/ios/main.jsbundle -F overwrite=true -F /workspace/app/index.ios.js=@$BUDDYBUILD_WORKSPACE/index.ios.js
echo -e "\n[BugSnag] Done uploading sourcemap\n"
function main(args) {
return new Promise( async (resolve, reject) => {
console.log('current max is '+totalChars);
var options = {
uri: 'https://www.comicvine.com/api/characters',
qs: {
api_key: key,
@iotashan
iotashan / ti.parse.js
Created June 17, 2015 15:38
Parse JS SDK ported to Titanium
/*!
* Parse JavaScript SDK
* Version: 1.3.4
* Built: Fri Jan 23 2015 12:45:28
* http://parse.com
*
* Copyright 2015 Parse, Inc.
* The Parse JavaScript SDK is freely distributable under the MIT license.
*
* Includes: Underscore.js
@iotashan
iotashan / LinkedInAuth.js
Created April 22, 2015 01:42
LinkedIn auth for Titanium
/*
* LinkedIn account authentfication library / module
* by Miroslav Magda, blog.ejci.net,
*
*
* Copyright 2012 Miroslav Magda
*
* All code is open source and dual licensed under GPL and MIT. Check the individual licenses for more information.
*/
@iotashan
iotashan / alloy.js
Last active March 2, 2017 15:18
Listening for android start/pause/stop/resume events in Titanium
if (OS_ANDROID) {
// Somehow, only in alloy.js we can get the data (URL) that opened the app
Alloy.Globals.url = Ti.Android.currentActivity.intent.data;
Ti.API.info('launch data: '+Ti.Android.currentActivity.intent.data);
Ti.Android.currentActivity.addEventListener('newintent',function(e){
Ti.API.info('newintent ' + JSON.stringify(e.intent.data));
});
Ti.Android.currentActivity.onCreate = function(e){
@iotashan
iotashan / GalaxyPrevail2
Created July 1, 2014 17:24
Android device screen specs
[INFO] : model: "SPH-M840"
[INFO] : Android: {"osname":"android","bubbleParent":true,"batteryState":0,"name":"android","version":"4.1.2","netmask":"255.255.255.0","locale":"en-US","processorCount":1,"manufacturer":"samsung","username":"se.infra","batteryLevel":-1,"address":"192.168.12.128","model":"SPH-M840","runtime":"v8","architecture":"ARMv7 Processor rev 2 (v7l)","batteryMonitoring":false,"displayCaps":{"bubbleParent":true,"ydpi":211.6666717529297,"xdpi":217.7142791748047,"logicalDensityFactor":1.5,"density":"high","platformWidth":480,"dpi":240,"platformHeight":800,"apiName":"Ti.Platform.DisplayCaps"},"macaddress":"10:D5:42:EA:B9:BF","availableMemory":2428648,"apiName":"Ti.Platform.Android","ostype":"32bit","id":"32a36719e34a63d9","physicalSizeCategory":2}
[INFO] : displayCaps: {"bubbleParent":true,"ydpi":211.6666717529297,"xdpi":217.7142791748047,"logicalDensityFactor":1.5,"density":"high","platformWidth":480,"dpi":240,"platformHeight":800,"apiName":"Ti.Platform.DisplayCaps"}
@iotashan
iotashan / gist:4128173
Created November 21, 2012 22:06 — forked from joshualambert/gist:4128161
Switch loop
followMeSwtichCheckbox.eventOverride = false;
followMeSwtichCheckbox.addEventListener('change', function(e) {
if (!followMeSwtichCheckbox.eventOverride) {
if (checkSOSactive() === false) {
alert('SOS inactive.');
} else {
followMeSwtichCheckbox.eventOverride = true;
followMeSwtichCheckbox.value = !followMeSwtichCheckbox.value;
}
<ios>
<min-ios-ver>4.3</min-ios-ver>
<plist>
<dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>