Skip to content

Instantly share code, notes, and snippets.

View kopiro's full-sized avatar

Flavio Maria De Stefano kopiro

View GitHub Profile
@dawsontoth
dawsontoth / verticalScrollableView.js
Created February 22, 2011 19:34
Vertical Scrollable View
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
var rotate = Ti.UI.create2DMatrix().rotate(90);
var counterRotate = rotate.rotate(-180);
var scrollView = Titanium.UI.createScrollableView({
views:[
Titanium.UI.createImageView({ image:'default_app_logo.png', transform: counterRotate }),
Titanium.UI.createImageView({ image:'KS_nav_ui.png', transform: counterRotate }),
Titanium.UI.createImageView({ image:'KS_nav_views.png', transform: counterRotate })
@benbahrenburg
benbahrenburg / gist:1515352
Created December 23, 2011 21:04
Titanium : How to find the Private Directory
function privateDocumentsDirectory(){
Ti.API.info('We need to open a file object to get our directory info');
var testFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory);
Ti.API.info('Now we remove the Documents folder reference');
var privateDir = testFile.nativePath.replace('Documents/','');
Ti.API.info('This is our base App Directory =' + privateDir);
Ti.API.info('Now we add the Private Documents Directory');
privateDir+='Library/Private%20Documents/';
Ti.API.info('Our new path is ' + privateDir);
@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@jaraen
jaraen / gist:1626498
Created January 17, 2012 12:31
Shadow property in TiUIView.m
-(void)setShadow_:(id)args
{
if(args != nil)
{
self.layer.masksToBounds = NO;
if ([args objectForKey:@"shadowOffset"] != nil) {
CGPoint p = [TiUtils pointValue: [args objectForKey:@"shadowOffset"]];
CGSize shadowOffset = {p.x,p.y};
@euforic
euforic / ti.socket.io.js
Created June 5, 2012 17:02
Socket.io-client Titanium
/*! Socket.IO.js build:0.9.6, development. Copyright(c) 2011 LearnBoost <dev@learnboost.com> MIT Licensed */
/**
* Originally Ported to titanium by Jordi Domenech <jordi@iamyellow.net>
* source: https://github.com/iamyellow/socket.io-client
*/
this.io = {};
module.exports = this.io;
/**
@keverw
keverw / gist:2922027
Created June 13, 2012 05:22
Mac say, Have your JavaScript Node.js app make your Mac speak.
global.escapeshell = function(cmd) { //http://stackoverflow.com/a/7685469
return '"'+cmd.replace(/(["\s'$`\\])/g,'\\$1')+'"';
};
global.say = function(string)
{
var os = require('os');
if (os.type() == 'Darwin')
{
@font-face {
font-family: 'EntypoRegular';
src: url('font/entypo.eot');
src: url('font/entypo.eot?#iefix') format('embedded-opentype'),
url('font/entypo.woff') format('woff'),
url('font/entypo.ttf') format('truetype'),
url('font/entypo.svg#EntypoRegular') format('svg');
font-weight: normal;
font-style: normal;
}
@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@FokkeZB
FokkeZB / LAZY.md
Last active December 16, 2015 21:39
Lazy exporting expensive properties

If you have a CommonJS module that exposes properties that are expensive to create (e.g. other CommonJS modules or some external resource), you can load them lazy using Object.defineProperty().

@douglasduteil
douglasduteil / .travis.yml
Last active February 22, 2021 13:27 — forked from lukewpatterson/gist:4242707
Here is how I allow Git SSH authentication in Travis CI. I'm using it to connect Travis to my repo organization AngularUI. This trick is a fork. The goal is to encode the RSA private deploy key in the .travis.yml as "-secure: xxxxx.....".
---
language: node_js
node_js:
- '0.10'
branches:
only:
- master
before_script: .travis/before_script.sh
script: echo -e " >>> Do something... \"grunt\" for example\n"
after_success: .travis/after_success.sh