Skip to content

Instantly share code, notes, and snippets.

var win = Ti.UI.createWindow({
backgroundColor: '#333'
});
var box = Ti.UI.createView({
backgroundColor:'blue',
center:{x:50,y:50},
height:40,
width:40
});
//This is a demo to show how backgroundLeftCap and backgroundTopCap work on the Tianium platform by Appcelerator
//Paste this code in app.js (tested on iOS)
//Screenshot: http://screencast.com/t/txWQD3l2UBN
///////////////////////////////////////////////////////////////////////////////
//Just modify these variables to see how backgroundLeftCap and topCap will work
var topCap = 20;
var leftCap = 35;
var originalImageSize = {height:100, width:100}
function uploadPhoto( _source, _callback) {
var onSuccess = function(e){
if(e.media){
Cloud.Photos.create({
photo: e.media
}, function (e) {
if (e.success) {
var photo = e.photos[0];
alert('Success:\\n' +
<Alloy>
<Window class="container" onOpen="App.loader">
<Button onClick="showAlertDialog">Alert</Button>
<AlertDialog id="alertDialog" title="title" message="This is my message" cancel="1">
<ButtonNames>
<ButtonName>OK</ButtonName>
<ButtonName>Cancel</ButtonName>
<ButtonName platform="android">android</ButtonName>
</ButtonNames>
</AlertDialog>
/*
Caching remote images
As you know, you can display local and remote images in a Titanium ImageView.
When loading remote images, you should set the defaultImage property to local image,
which will be displayed while the remote image is being downloaded.
Furthermore, you should cache remote images that will be frequently accessed for two reasons:
first so that subsequent uses of your app will load those images more quickly,
and second, so that the images aren't re-downloaded consuming users' data quotas unnecessarily.
<?php
/**
* Bootstrap
* @author Aleksandr Torosh <webtorua@gmail.com>
* https://github.com/oleksandr-torosh/phalcon-modular-app/blob/master/app/Bootstrap.php
*/
class Bootstrap
{
@serebro
serebro / Slider.php
Last active April 15, 2019 09:00
Phalcon Widget
<?php
/* /app/widgets/Slider.php */
namespace Widgets;
use Widget;
// Наш новый виджет слайдера
class Slider extends Widget
@serebro
serebro / Censure.php
Last active October 29, 2023 10:28
Censure.php
<?php
/**
* Определение наличия мата (нецензурных слов) в тексте, матотест
*
* Алгоритм достаточно надёжен и быстр, в т.ч. на больших объёмах данных
* Метод обнаружения мата основывается на корнях и предлогах русского языка, а не на словаре
* Слова "лох", "хер", "залупа", "сука" матерными словами не считаются (см. словарь Даля)
* Разработка ведётся с 2005 года
*
* Класс явл. хорошим учебным пособием по изучению регулярных выражений и... русского мата! =)
@serebro
serebro / array_find.php
Created August 19, 2014 14:11
array_find
/**
* @return mixed or false
*/
function array_find($array, $fn) {
$next = current($array);
while ($next) {
$key = key($array);
if (call_user_func_array($fn, [$next, $key])) {
return $next;
}
@serebro
serebro / Url.php
Last active August 29, 2015 14:05
Generate Phalcon URL with GET params
<?php
class Url extends \Phalcon\Mvc\Url
{
/**
* Generates a URL with GET params
*
* <code>
*