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
var usuarioJaExiste = function ( err, data, res, req ) {
var dados,
model;
if ( err ) return res.json(err);
if ( data ) return res.json({ Error: "Usuario ja existe.", Code: 0 });
dados = {
idFace: req.body.idFace,
arrayUsuario: [{
@DouglasHennrich
DouglasHennrich / multi-git.md
Last active September 2, 2015 22:35 — forked from rosswd/multi-git-win.md
Setting up a Github and Bitbucket account on the same computer.

Setting up github and bitbucket on the same computer

Github will be the main account and bitbucket the secondary.

Create SSH Keys

ssh-keygen -t rsa -C "github email"

Enter passphrase when prompted. If you see an option to save the passphrase in your keychain, do it for an easier life.

@DouglasHennrich
DouglasHennrich / README.md
Last active September 8, 2015 18:15 — forked from FokkeZB/README.md
URL schemes for iOS and Android (2/2)
@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 / 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 / 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 / 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 / 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 / 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.
*/
/**
* 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");