Skip to content

Instantly share code, notes, and snippets.

View zaherg's full-sized avatar
🎯
Focusing

Zaher Ghaibeh zaherg

🎯
Focusing
View GitHub Profile
@ricardoalcocer
ricardoalcocer / actionbarhelper.js
Last active December 24, 2015 06:09
NOTE: I HAVE CREATED A FULL SAMPLE APP LOCATED AT https://github.com/ricardoalcocer/tiactionbarhelper. ANY UPDATES TO THE LIBRARY WILL BE MADE ON THAT REPO, SO THIS VERSION WILL BE OUTDATED. CommonJS module for working with the ActionBar in Titanium.
/*
* ActionBar Helper Class for Appcelerator Titanium
* Author: Ricardo Alcocer
*
* Licensed under the MIT License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://alco.mit-license.org/
*
@benbahrenburg
benbahrenburg / AddingFetchToSDK.md
Last active August 13, 2016 17:28
This gist outlines an approach for adding the fetch background mode to Titanium

This document details how to add the background mode of fetch into the Titanium SDK. It is important to note that once these updates are performed you will be able to attach a listener to be called when the fetch background mode is triggered.

After the below updates are made, you can clear your Titanium project and run this sample app.js to view how it works.

TiBase.h and TiBase.m updates

The first step in adding the fetch background mode is to create the const values that will later be used when adding or listening to notification center.

To do this first open the TiBase.h file and add the const of

@adamchal
adamchal / ngx_http_upload_module.c
Created September 5, 2013 22:16
ngx_http_upload_module.c with patch applied so that Nginx Upload Module works with Nginx 1.4.2+. To use, replace the ngx_http_upload_module.c file in https://github.com/vkholodkov/nginx-upload-module with this Gist.
/*
* Copyright (C) 2006, 2008 Valery Kholodkov
* Client body reception code Copyright (c) 2002-2007 Igor Sysoev
* Temporary file name generation code Copyright (c) 2002-2007 Igor Sysoev
*/
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
#include <nginx.h>
@neilk
neilk / vagrant-ssh-node
Created August 22, 2013 18:42
SSH into a Vagrant VM, such that Node.js can be debugged from a debugger or IDE in the host operating system. For some reason, port forwarding in the Vagrant file does not work. See https://groups.google.com/forum/#!topic/vagrant-up/RzPooJ0dp6Q
#!/bin/bash
# SSH into a Vagrant VM, forwarding ports in a way that allows node within Vagrant to be debugged by a debugger
# or IDE in the host operating system. Don't know why, but Vagrantfile port forwarding does not work.
# (https://groups.google.com/forum/#!topic/vagrant-up/RzPooJ0dp6Q)
/usr/bin/vagrant ssh-config > $TMPDIR/vagrant-ssh-config
ssh -F $TMPDIR/vagrant-ssh-config -L 5858:127.0.0.1:5858 default
rm $TMPDIR/vagrant-ssh-config
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active February 27, 2025 16:31
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@dhrrgn
dhrrgn / idea.md
Last active December 20, 2015 12:39

In PHP we have the for and foreach loops, which are both handy, but there is a case where a 3rd type of for loop would be handy: Iterators.

With 5.5 it became super easy to use Iterators, by simple creating a Generator. While working on my itertools port to PHP (here), I found a situation where both the for and foreach constructs fell short.

Example

I had created counter Generator which just creates an Iterator that starts at a given number and counts indefinitely. Then, I wanted to create a version of range which used an Iterator. Now, I could do this with a few for loops like in the PHP docs, but I wanted to use my new fancy counter function, so I started with a for loop:

@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);
@jasonkneen
jasonkneen / 1readme.md
Last active May 28, 2021 16:48
Quick example of registering a URLScheme in a Titanium app using the TiApp.xml without info.plist file. Just add the following into your TiApp.xml (I put it under the </iphone> tag. Works on Android and iOS.

Quick Example of registering a scheme in TiApp.xml, implementing the code in app.js / alloy.js

@FokkeZB
FokkeZB / CROP.md
Created May 2, 2013 09:43
Image (cropping) CommonJS lib for Titanium

Often I need to display a user-provided picture in an ImageView in such a way that the whole ImageView is filled with as much of the picture possible.

This is how I do it:

var image = require('image');

Ti.Media.showCamera({
        mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO],
 success: function (e) {
@FokkeZB
FokkeZB / RATING.md
Last active December 16, 2015 16:49
Rate-my-app CommonJS module for Titanium