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 / repl.js
Created August 22, 2013 07:35
Android density specific folders
var logicalDensityFactor = Ti.Platform.displayCaps.logicalDensityFactor,
density,
orientation = (Ti.Gesture.orientation === Ti.UI.LANDSCAPE_LEFT) ? "land" : "port",
width = Ti.Platform.displayCaps.platformWidth,
height = Ti.Platform.displayCaps.platformHeihgt,
ratio = ((width / height) < ((orientation === "land") ? (320 / 240) : (240 / 320))) ? "long" : "notlong",
folders = [],
shortnames = {
"ldpi": "low",
"mdpi": "medium",
@FokkeZB
FokkeZB / app.tss
Created August 21, 2013 08:18
Hide titlebar on Android launch/splash screen
// app/styles/app.tss
"Window": {
navBarHidden: false
}
@FokkeZB
FokkeZB / FUNCTIONS.md
Last active December 21, 2015 04:19
Declaring a function in a code block

In the wrong.js file below you'll get JSLint errors and after Alloy compiles both function declarations will be there. The right.js file shows how it should be done.

// Put me in: ~/Library/Application Support/Sublime Text 2/Packages/User/
[{
"id": "view",
"children": [{
"id": "layout",
"children": [{
"command": "set_layout",
"caption": "Custom: 3 Pane",
"mnemonic": "C",
@FokkeZB
FokkeZB / DOWNSIZE.md
Last active December 8, 2016 10:39
Automatically generate non-retina and Android images for Alloy projects

UPDATE: With the assets command of the TiCons CLI / Module this can be done even simpeler by calling $ ticons assets or an alloy.ymk using:

task("pre:load", function(event, logger) {
    require('ticons').assets();
});

@FokkeZB
FokkeZB / app.tss
Last active December 19, 2015 21:09 — forked from tonylukasavage/app.tss
'Label[platform=android]': {
color: '#000' // all platforms except Android default to black
}
'Window': {
backgroundColor: '#fff' // white background instead of default transparent
}
'Window[platform=android]': {
modal: false // make android windows all heavyweight
@FokkeZB
FokkeZB / IMPORT.md
Last active May 24, 2023 21:24
Add support for @import to Alloy styles

@import TSS for Alloy

NOTE: This is out-dated, I suggest using https://github.com/dbankier/ltss instead.

This alloy.jmk adds support for using CSS-like @import "file.tss"; statements in Alloy TSS styles.

The idea for this came when discussing adding the option of including a CSS-like reset stylesheet in Alloy to make up for platform differences in (background)color, but also some good practices.

I think one of the key issues in this discussion is that there is no such thing as the base style for an app. iOS fans would like to reset to iOS-like styles, Android fans like to reset to theirs, flat UI fanatics would like everything minimalized and Bootstrap adepts will ask for a huge library of styles.

@FokkeZB
FokkeZB / pushDisabled.js
Created July 10, 2013 14:21
Titaniums Ti.Network methods and properties give little information about the current status of push notifications. This is pretty much as far as it goes.
if (Ti.Network.remoteNotificationsEnabled) {
Ti.API.info('User has enabled push');
} else if (Ti.Network.remoteDeviceUUID === null) {
Ti.API.info('User has never enabled push');
} else {
Ti.API.info('User has manually disabled push');
}
@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)) {
@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;
}