Skip to content

Instantly share code, notes, and snippets.

View viezel's full-sized avatar

Mads Møller Schrøder viezel

View GitHub Profile
@viezel
viezel / app.js
Last active August 29, 2015 14:14
appcelerator - HTTP requsts queing system while being offline
//
// Start the app while being offline
// Then after these requests have been cache - go back online
//
var HTTPHelper = require("networkHelper");
// simulate some request while being offline
for(var i = 0; i < 5; i++){
setTimeout(function(){
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- array of downloads. -->
<key>items</key>
<array>
<dict>
<!-- an array of assets to download -->
@viezel
viezel / build-module-android.sh
Last active August 29, 2015 14:01
Build and copy android module
##
## Build an Appcelerator Android Module
## Then copy it to the default module directory
##
## (c) Napp ApS
## Mads Møller
##
## HOW TO GUIDE
@viezel
viezel / bugsnag.js
Last active August 29, 2015 14:01
bugsnag angular module
// bugsnag module
angular.module('napp-angular-bugsnag', []).run(['$rootScope', function($rootScope) {
$rootScope.$on('ServerException', function(evt, err) {
Bugsnag.user = {
id: napp.getUserId(),
name: napp.getUsername()
};
var exception = "ErrorException";
@viezel
viezel / downloadManager.js
Last active March 13, 2016 19:04
Download Manager for Titanium using om.kcwdev.downloader
/**
* Download Manager
* Manage downloads of assets through a third party module
* It also keeps track of the downloaded files in a queue.
* Dependency: A native module for iOS & Android
* @author Mads Møller
* @version 1.0.0
* Copyright Napp ApS
* www.napp.dk
*/
@viezel
viezel / api.js
Last active August 29, 2015 13:57
Angular API - Restful
app.factory('API', ['$http', function($http){
// API url
var apiURL = "/api/v1/";
// defuauly HTTP Headers
var defaultHeaders = {
"X-API-KEY": angular.getAPIKey()
"X-SOMETHING": "123"
};
/*! Socket.IO.js build:0.9.6, development. Copyright(c) 2011 LearnBoost <[email protected]> MIT Licensed */
/**
* Originally Ported to titanium by Jordi Domenech <[email protected]>
* source: https://github.com/iamyellow/socket.io-client
*/
this.io = {};
module.exports = this.io;
/**
@viezel
viezel / local.xml
Last active December 20, 2015 08:19
Magento - How to move Toolbar to the left/right column
<catalog_category_layered translate="label">
<reference name="left">
<!-- Adds the toolbar to the left column -->
<block type="catalog/category_view" name="category.page.toolbar" template="catalog/category/sidetoolbar.phtml">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml" />
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>
</block>
@viezel
viezel / NappUI.js
Last active December 19, 2015 16:38 — forked from raulriera/NappUIHack.js
// We need to add the following proxies to our project before Napp UI works.
// This is due to some limitations of the Titanium Module SDK
// Please run this after you require the
exports.initNappUI() {
require('dk.napp.ui'); // require the module
// window and tabs
@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);