Skip to content

Instantly share code, notes, and snippets.

View aj07mm's full-sized avatar

Julio Marins aj07mm

View GitHub Profile
<?php
trait MetaClass
{
protected $__classMethods = array();
static protected $__staticMethods = array();
public function __call($name, $args)
{
@aj07mm
aj07mm / gist:0b7395f30549610c0073
Created June 6, 2014 17:43
Problema com closures!
var assert = require("assert")
var mongo = require('./mongo.js')
var databaseUrl = "leitordecarga";
var collections = ["tables"]
var db = require("mongojs").connect(databaseUrl, collections);
callback = [];
db.open(function(err, db) {
if (!err) {
Switcher = {
getNumberOfColumns: function(){
//menos as 5 columns default
//retorna só as colunas sem switch
return ($('td.tablesorter-header').length/2)-5;
},
getIncrementator:function(){
var i = 3;
for (var i = 1; i <= 5; i++) {
if(getNumberOfColumns() == i){
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
@aj07mm
aj07mm / gist:ebe045bd636990dad6cb
Last active August 29, 2015 14:16
Sending email to list/batch with Mandrill [nodejs]
var message = {
"html": 'asdasd',
"text": 'asdasd',
"subject": 'asdasdasd',
"from_email": "[email protected]",
"from_name": "Leilão de Ônibus",
"to": [{
"email": '[email protected]',
"type": "to"
},{
@aj07mm
aj07mm / gist:036acc6da39f432774bf
Last active August 29, 2015 14:16
how to test response in a callback inside a method inside a method?
'sendMail': function(mailBody,maiSubject,mailTo, sendAt){
if(mailTo == 'string'){
mailTo = formatMailTo(mailTo);
}
var message = {
"html": mailBody,
"text": mailBody,
"subject": maiSubject,
@aj07mm
aj07mm / javascript
Created March 13, 2015 01:00
what if [callback]
this.sendMail = function(mailBody,maiSubject,mailTo, sendAt, callback){
if(mailTo == 'string'){
mailTo = formatMailTo(mailTo);
}
var message = {
"html": mailBody,
"text": mailBody,
"subject": maiSubject,
"from_email": "[email protected]",
@aj07mm
aj07mm / gist:30087bcbdc0bb7b44e1a
Created March 25, 2015 18:07
filter rethinkdb
filtered = list(r.table(collection).filter(
lambda doc: \
(doc['id'] == _filters.get('id')).default(False) | \
(doc['userIds'].contains(_filters.get('userIds'))).default(False) | \
(doc['checkpointIds'].contains(_filters.get('checkpointIds'))).default(False)
).run(self.rdb_conn))
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="com.ionicframework.bustracker165613" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action
var socket = io.connect('http://' + document.domain + ':' + location.port + '/profile');
var CommentList = React.createClass({
render: function() {
var data = this.props.data;
var foo = data.map(function(row){
console.log(row)
return <tr data-reactid={row.id}>
<td>{row.place}</td>