Skip to content

Instantly share code, notes, and snippets.

View talcual's full-sized avatar
💭
Magic Code

Luis Toscano talcual

💭
Magic Code
View GitHub Profile
@talcual
talcual / table2jsonex
Last active August 29, 2015 14:21
Ejemplo de Utilizacion de Table 2 JSON
<script type="text/javascript">
// Basic Usage
var table = $('#example-table').tableToJSON();
// table == [{"First Name"=>"Jill", "Last Name"=>"Smith", "Score"=>"disqualified"},
// {"First Name"=>"Eve", "Last Name"=>"Jackson", "Score"=>"94"},
// {"First Name"=>"John", "Last Name"=>"Doe", "Score"=>"80"},
// {"First Name"=>"Adam", "Last Name"=>"Johnson", "Score"=>"67"}]
// Ignore first column (name)
var table = $('#example-table').tableToJSON({
@talcual
talcual / init.lua
Created October 23, 2015 20:50 — forked from creationix/init.lua
Websocket server in nodemcu using new crypto module.
wifi.setmode(wifi.STATION)
wifi.sta.config("creationix","noderocks")
wifi.sta.connect()
tmr.alarm(0, 1000, 1, function ()
local ip = wifi.sta.getip()
if ip then
tmr.stop(0)
print(ip)
dofile("websocket.lc")
dofile("main.lc")
@talcual
talcual / chatServer.js
Created October 27, 2015 22:26 — forked from creationix/chatServer.js
A simple TCP based chat server written in node.js
// Load the TCP Library
net = require('net');
// Keep track of the chat clients
var clients = [];
// Start a TCP Server
net.createServer(function (socket) {
// Identify this client
@talcual
talcual / gist:6acb1c32e9240061ef893b2e1a9c563b
Created April 30, 2016 20:19 — 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
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@talcual
talcual / mysql-backup-windows.bat
Created August 3, 2016 15:43 — forked from sindresorhus/mysql-backup-windows.bat
Backup MySQL databases in separate gzipped sql files on Windows
@echo off
set dbUser=root
set dbPassword=password
set backupDir="C:\Documents and Settings\user\Desktop\backup\mysql"
set mysqldump="C:\Program Files\MySQL\MySQL Workbench 5.2 CE\mysqldump.exe"
set mysqlDataDir="C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\data"
set zip="C:\Program Files\7-Zip\7z.exe"
:: get date
@talcual
talcual / startup-app.sh
Created August 3, 2016 19:58 — forked from touv/startup-app.sh
Startup script for Express / Node.js application with the forever module
#!/bin/sh
##3.5...10...15...20...25...30...35...40...45...50...55...60...65...70...75...80
##
## Debian / Linux / Ubuntu / LSB
## Startup script for Express / Node.js application with the forever module
##
##
## A modification of "init.d.lsb.ex" by Nicolas Thouvenin
##
##
@talcual
talcual / public-app.js
Created August 6, 2016 04:26 — forked from jrmoran/public-app.js
AngularJS and Express, rendering ejs-locals partials
var app = angular.module('app', ['ngResource']);
app.config(function($locationProvider, $routeProvider) {
// $locationProvider.html5Mode(true);
$routeProvider
.when('/', { templateUrl: 'partials/index', controller: 'ctrl' })
.when('/about', { templateUrl: 'partials/about', controller: 'ctrl' })
.otherwise({redirectTo:'/'});
});
@talcual
talcual / gist:0bf4d4ce2f35f3a6feeca0a5c325a160
Created September 4, 2016 04:50 — forked from tvdsluijs/gist:fc0bb40ee0fe0805df8d
Mongodb php aggregation $match $or usage
$m = new MongoClient(); // connect to local mongodb
$db = $m->products; //select 'mongo database' named products
$clothing_col = $db->clothing; //create a collection from the 'table' clothing
//create the aggregation
//create the Match on clothing-category = shoes or brand = nike
$ops = array(
array(
'$match' =>
array('$or' =>
@talcual
talcual / add_item.php
Created October 29, 2016 08:35 — forked from davidtsadler/add_item.php
Example showing how to list an item to the eBay Sandbox using the eBay Accelerator Toolkit New Schema (EbatNS) for PHP.
<?php
/*
* Author: David T. Sadler (http://davidtsadler.com)
* Date: 2013-03-29
* License: I release this example into the public domain. Use at your own risk.
*
* Example showing how to list an item to the eBay Sandbox using the eBay Accelerator Toolkit New Schema (EbatNS) for PHP.
*
* This example uses version 815 released on the 2013-03-22.
* http://www.intradesys.de/en/system/files/its_downloads/EbatNs_1_0_815_P5_0.zip
@talcual
talcual / firebase.php
Created February 5, 2017 23:32 — forked from krhoyt/firebase.php
Interact with Firebase from PHP.
<?php
// Constants
$FIREBASE = "_YOUR_FIREBASE_URL_";
$NODE_DELETE = "temperature.json";
$NODE_GET = "temperature.json";
$NODE_PATCH = ".json";
$NODE_PUT = "temperature.json";
// Data for PUT