Skip to content

Instantly share code, notes, and snippets.

View DouglasHennrich's full-sized avatar

Douglas Hennrich DouglasHennrich

  • Brazil - RS - Estância Velha
View GitHub Profile
@DouglasHennrich
DouglasHennrich / resetsims.js
Last active October 22, 2019 19:54 — forked from cb1kenobi/resetsims.js
Resets all iOS, watchOS, and tvOS simulators
'use strict';
const execSync = require('child_process').execSync;
const json = JSON.parse(execSync('xcrun simctl list --json'));
for (const runtime of Object.keys(json.devices)) {
for (const device of json.devices[runtime]) {
console.log(`Removing ${device.name} (${device.udid})`);
execSync(`xcrun simctl delete ${device.udid}`);
}
@DouglasHennrich
DouglasHennrich / README.md
Created April 12, 2016 17:33 — forked from falkolab/README.md
How to use latest Alloy with appc CLI

If you want to use latest alloy with appc CLI command:

  1. Update Alloy: [sudo] npm install -g alloy

  2. Create file in your project <project root>/plugins/global.alloy/1.0/hooks/global_alloy_hook.js with content:

exports.init = function (logger, config, cli, appc) {
	delete process.env.ALLOY_PATH;
};
/**
* Ti.TouchID
*
* Summary: Support native Touch ID with Hyperloop in Titanium Mobile.
* Author: Hans Knoechel | Appcelerator, Inc
* Date: 03/22/2016
* Version: 0.1.0
* Example
*
* var touchID = require("ti.touchid");
@DouglasHennrich
DouglasHennrich / patched socket.io.js
Created January 21, 2016 21:48 — forked from ndob/patched socket.io.js
Socket io 1.2.0 patched to work with tiws (https://github.com/omorandi/tiws)
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.io=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
module.exports = _dereq_('./lib/');
},{"./lib/":2}],2:[function(_dereq_,module,exports){
/**
* Module dependencies.
*/
@DouglasHennrich
DouglasHennrich / remodelagem-para-mongodb.md
Created December 4, 2015 21:25 — forked from suissa/remodelagem-para-mongodb.md
Um aluno do Be MEAN postou essa modelagem relacional a qual ele estava com dificuldades para passar para o MongoDB, então vou ensinar aqui como faz

Remodelagem do Relacional para o MongoDb

Um aluno do Be MEAN postou essa modelagem relacional a qual ele estava com dificuldades para passar para o MongoDB, então vou ensinar aqui como faz

Vamos inicialmente separar pelas COLEÇÕES que achamos que devemos ter:

  • Usuario;
  • Escola;
@DouglasHennrich
DouglasHennrich / Source_app_index.js
Created November 24, 2015 04:34 — forked from skypanther/Source_app_index.js
Custom URL Schemes: Tap a button in the "Source" app and have it open "Target" Works in iOS and Android. For the Target app's manifest, you'll need to create a PROJECT_DIR/platform/android folder and put the file in there. This is an Alloy-based demo, tested on Titanium 3.0.0.GA.
function doClick(e) {
if(OS_IOS) {
if(Ti.Platform.canOpenURL('Urlschemes://')) {
Ti.Platform.openURL('Urlschemes://');
} else {
alert('You must install the Urlschemes app first');
}
} else {
var didItWork = Ti.Platform.openURL('urlschemes://');
if(!didItWork) {
@DouglasHennrich
DouglasHennrich / index.js
Created November 6, 2015 16:21 — forked from falkolab/index.js
How to use SVG as View backgroundImage
$.getView().backgroundImage = getImageFileFromSVG({
image : "/images/hearts.svg",
width : 400,
height : 400,
top : 0,
left : 0
});
function getImageFileFromSVG(svgOpts) {
var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationCacheDirectory,
@DouglasHennrich
DouglasHennrich / actionBarMenuItem.js
Created November 6, 2015 16:18 — forked from falkolab/actionBarMenuItem.js
Icon font MenuItem in ActionBar menu for Titanium SDK
var args = arguments[0] || {};
if(__parentSymbol) {
// recreate menu item
$.getTopLevelViews().length = 0;
__parentSymbol.removeItem(9999);
$.__views.menuItem = __parentSymbol.add(
_.extend(_.pick(args, Alloy.Android.menuItemCreateArgs), {
actionView: $.actionView
})
@DouglasHennrich
DouglasHennrich / androidPushNotification.php
Last active October 6, 2015 04:47 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console ( Server KEY )
define( 'API_ACCESS_KEY', 'SERVER-API-KEY' );
$registrationIds = array( "userToken", "user2Token" );
$nome_empresa = "Sheep Kebab";
$id_push = "1";
$id_empresa = "2";
$abrirPush = "1";
$payload = '{"id_push":'.$id_push.',"id_empresa":'.$id_empresa.', "abrir":' . $abrirPush . '}';
@DouglasHennrich
DouglasHennrich / README.md
Last active September 8, 2015 18:15 — forked from FokkeZB/README.md
URL schemes for iOS and Android (2/2)