Skip to content

Instantly share code, notes, and snippets.

View juanghurtado's full-sized avatar
🙄

Juan G. Hurtado juanghurtado

🙄
View GitHub Profile
@juanghurtado
juanghurtado / device-storage.coffee
Created January 9, 2014 09:33
Mock Firefox OS Device Storage API. Note that now we only mock enumerate() method here.
# -----------------------------------------------------------------------------
# UTILS
# -----------------------------------------------------------------------------
convertBase64ToBinary = (base64) ->
raw = window.atob base64
rawLength = raw.length
array = new Uint8Array(new ArrayBuffer(rawLength))
i = 0
while i < rawLength
define [
'modules/main/views/general-view'
'app.framework'
'communication-bus'
], (GeneralView, Framework, Bus) ->
# ----------------------------------------------------------------------------
# Class definition
# ----------------------------------------------------------------------------
class ShowController extends Framework.Controller
initramfs initramfs.gz 0x00a00000
arm_freq=840
core_freq=375
gpu_mem_256=128
gpu_mem_512=128
sdram_freq=400
over_voltage=0
hdmi_force_hotplug=1
disable_overscan=1
@juanghurtado
juanghurtado / .gitconfig
Created October 17, 2013 06:52
Git config file
[credential]
helper = osxkeychain
[core]
editor = mvim -vf
excludesfile = ~/.gitignore
pager = less -x2
[alias]
st = status -sb
ci = commit -m
am = commit --amend -C HEAD
@juanghurtado
juanghurtado / samplespec.coffee
Last active December 17, 2015 13:39
Sinon fake server making fixtures fail on another spec file!
define [
'backbone'
'framework/entities/entities'
], (Backbone) ->
beforeEach ->
# Start the sandbox, telling it to use a fake server
@sandbox = sinon.sandbox.create()
@sandbox.useFakeServer()
define(['backbone','modules/todo/models/todo', 'backbone.localstorage'],function(Backbone, Todo) {
var isCompleted = function(todo) {
return todo.get('done');
};
var Collection = Backbone.Collection.extend({
model: Todo,
localStorage: new Backbone.LocalStorage('todosmvc:todos'),
comparator: function(todo) {
@juanghurtado
juanghurtado / SampleModule01.js
Last active December 13, 2015 22:19
Which option is better? A global CommunicationBus object (with Wreqr), or each module with their owns Wreqr instances?
// OPTION 1
// Each module has their own "commands", "reqres" and "vent" objects,
// instancing new Wreqr objects for each one
define(['backbone.wreqr'], function(Wreqr) {
var SampleModule = {
commands : new Wreqr.Commands(),
reqres : new Wreqr.RequestResponse(),
vent : new Wreqr.EventAggregator()
};
@juanghurtado
juanghurtado / app.js
Created September 3, 2012 08:58
Force portrait mode for Android on Appcelerator
if (Ti.Platform.osname.match(/android/g)){
Ti.Gesture.addEventListener('orientationchange', function(e) {
Ti.Android.currentActivity.setRequestedOrientation(Ti.Android.SCREEN_ORIENTATION_PORTRAIT);
});
}
@juanghurtado
juanghurtado / app.js
Created July 24, 2012 07:11 — forked from minhnc/app.js
Activity Indicator
var LoadingIndicator = require('utils/ui/LoadingIndicator');
var win = Ti.UI.createWindow();
var loadingIndicator = new LoadingIndicator();
win.add(loadingIndicator);
loadingIndicator.show({message: 'Loading...'});
// TODO - Access to DB - Here I use timeout for demo purpose
@juanghurtado
juanghurtado / CSS.js
Created July 16, 2012 07:39
Styling system for Appcelerator
(function() {
/* =DEPENDENCIES
--------------------------------------------------------------------------- */
var _ = require('utils/common/underscore')._;
/* =CONSTRUCTOR
--------------------------------------------------------------------------- */
var CSS = {
/*