Skip to content

Instantly share code, notes, and snippets.

View lucafregoso's full-sized avatar

Luca Fregoso lucafregoso

View GitHub Profile
@paulirish
paulirish / rAF.js
Last active November 11, 2024 03:20
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'];
@brunjo
brunjo / gist:2462761
Created April 22, 2012 08:42
JavaScript - detect CSS transform 3d support and supported browser prefix
//window.onload=function(){
var supportedPrefix,
supports3d = false,
prefixes = [ "Webkit", "Moz", "ms", "O" ],
div = document.createElement("div");
if ( div.style.perspective !== undefined ) {
/*Browser supports CSS transform 3d without prefix*/
supportedPrefix = "";
supports3d = true;
@markjaquith
markjaquith / gist:2653957
Created May 10, 2012 15:36
WordPress Fragment Caching convenience wrapper
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
@Mithrandir0x
Mithrandir0x / gist:3639232
Created September 5, 2012 16:15
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@aaronksaunders
aaronksaunders / post.js
Last active March 16, 2019 14:57
Start of rest adapter for Appcelerator Alloy & sample model file
//
// blog.clearlyionnovative.com
// twitter: @aaronksaunders
//
// Model file for integration Appcelerator Titanium Alloy with Wordpress JSON Plugin
//
exports.definition = {
config : {
"columns" : {},
@kvandenhaute
kvandenhaute / nginx.conf
Created March 28, 2013 11:06
Example of a good working Nginx configuration.
user www-data;
# As a thumb rule: One per CPU. If you are serving a large amount
# of static files, which requires blocking disk reads, you may want
# to increase this from the number of cpu_cores available on your
# system.
#
# The maximum number of connections for Nginx is calculated by:
# max_clients = worker_processes * worker_connections
worker_processes 1;
@tsteur
tsteur / find_unused_styles_in_titanium_mobile_alloy.php
Created April 26, 2013 18:26
Finds unused styles within a Titanium Mobile - Alloy project. In order to execute it you need to place it within the root of your Titanium project and execute it using `php find_unused_styles_in_titanium_mobile_alloy.php`. PHP should be preinstalled on almost all Macs. Script only searches for app/styles/*.tss files. It does not perform a search…
<?php
foreach (getAllTssFilenames() as $tssfile){
echo "\nSearching for unused styles in $tssfile:\n";
outputUnusedStyles($tssfile);
}
function getAllTssFilenames()
{
return glob('app/styles/*.tss');
@kwhinnery
kwhinnery / howto.md
Created May 13, 2013 00:42
Execute "tishadow run" in your Titanium app directory whenever a JavaScript file changes.

Automatic TiShadow Installs

Execute "tishadow run" in your Titanium app directory whenever a JavaScript file changes. Edit your JS files in a text editor, save, then switch to the test device or simulator. Profit.

Install supervisor

[sudo] npm install -g supervisor

Execute tishadow run anytime a JavaScript file changes

@viezel
viezel / app.js
Last active June 15, 2020 19:13
Codebird for Appcelerator Titanium. Using the Twitter API 1.1
// This is an example of use.
// Here we use the new Bearer Token thats make it possible to get tweets without user login
// More info on Bearer here: https://dev.twitter.com/docs/auth/application-only-auth
// Full Codebird API is here: https://github.com/mynetx/codebird-js
var Codebird = require("codebird");
var cb = new Codebird();
cb.setConsumerKey('CONSUMER_KEY', 'CONSUMER_SECRET_KEY');
var bearerToken = Ti.App.Properties.getString('TwitterBearerToken', null);