Skip to content

Instantly share code, notes, and snippets.

View FokkeZB's full-sized avatar
*️⃣
Zappin'

Fokke Zandbergen FokkeZB

*️⃣
Zappin'
View GitHub Profile
@FokkeZB
FokkeZB / VALIDATE.md
Last active December 16, 2015 22:39
Validation lib for Titanium
@FokkeZB
FokkeZB / SLIDE-DOWN.md
Last active November 12, 2020 13:47
Slide-down menu for Titanium Alloy

This gist shows you how to do a slide-down menu in Titanium.

Features:

  • Toggle using a menu button in the ever-visible navigation bar on the top of the screen
  • Menu options animating down from under the navigation bar
  • Hide by swiping the menu options up
  • Hide by tapping the area below the menu options (being the view covered by the slide-down menu

Images:

@FokkeZB
FokkeZB / SHADOW.md
Created May 10, 2013 11:45
Label shadows for Titanium Android

Supporting text shadow for Labels on Android has been a request ever since Titanium 1.7.x. It's now scheduled for 3.2.x, but it probably has been for every version since :)

This small workaround works for 80% of what I need: just a tiny small shadow 1 pixel up or down.

However, you must know that:

  • It returns a Label in a Label, which is not officially supported.
  • Any further calls to properties or methods will be on the outer (shadow) label only.
  • If you use {x:1} as offset, in reality the text will be positioned {left:-1} relative to the shadow.
  • Because of the former note this workaround will doo only for small offsets.
@FokkeZB
FokkeZB / AUDIO.md
Created May 13, 2013 08:51
AudioPlayer states

Just so me and you both know from now on... for some reason:

streamer.addEventListener('change', function (e) {

    // This doesn't work
    if (e.state === Ti.Media.AudioPlayer.STATE_PAUSED) doSomeThing();
    
    // This does:
    if (e.state === this.STATE_PAUSED) doSomeThing();
@FokkeZB
FokkeZB / LOCALE.md
Last active December 17, 2015 15:59
Setting the language for in-app system dialogs and App Store listings.
@FokkeZB
FokkeZB / MODEL-DB.md
Last active December 17, 2015 18:49 — forked from timanrebel/Profile.js
Workaround for binding existing models in Alloy
@FokkeZB
FokkeZB / Profile.js
Last active December 17, 2015 18:49 — forked from timanrebel/Profile.js
Another workaround
// Alloy doesn't listen to changes, so we do:
$model.on('change', function (model) {
$.name.text = model.get('name');
});
@FokkeZB
FokkeZB / REPETITIVE.md
Created May 27, 2013 19:19
Best event for repetitive taps

Repetitive taps

I needed the right event to react on many repetitive taps. I noticed that click stops firing after some taps, so I did a little test to find the right event to listen to instead.

As the console.log shows, you need singletap ;)

@FokkeZB
FokkeZB / alloy.jmk
Created June 26, 2013 07:47 — forked from tsteur/alloy.jmk
My complete alloy.jmk will be here ;)
function isProduction(alloyConfig)
{
return 'production' == alloyConfig.deployType;
}
function removeUnimportantLogCallsFromContent(content)
{
if (!content) {
return;
}
@FokkeZB
FokkeZB / index.php
Last active February 26, 2022 22:44
Script to create custom shortcuts on the iOS springboard. Check it out at: http://dev.fokkezb.nl/shortcutter
<?
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (!empty($_FILES['icon']['tmp_name']) && !$_FILES["file"]["error"]) {
$icon = new Imagick($_FILES['icon']['tmp_name']);
unlink($_FILES['icon']['tmp_name']);
}
if (empty($icon)) {