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
@jakebellacera
jakebellacera / ICS.php
Last active April 19, 2024 09:06
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
@creationix
creationix / chatServer.js
Created November 19, 2010 20:47
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
@max-mapper
max-mapper / awesome.html
Created May 12, 2011 15:37
node-serialport + arduino + popcorn.js DIY video scrubber
<html>
<head>
<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script src="http://burritopizza.local/socket.io/socket.io.js"></script>
<script src="https://gist.github.com/raw/952547/f298c7e30d0978da0c78df0ff79436e883efbad2/gistfile1.txt"></script>
<script src="http://popcornjs.org/code/players/youtube/popcorn.youtube.js"></script>
<style type='text/css'>
body {
}
@clarle
clarle / app.js
Created July 26, 2012 07:35
Short tutorial on how to use Express and node-mysql
// Module dependencies
var express = require('express'),
mysql = require('mysql');
// Application initialization
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
@davidtsadler
davidtsadler / add_item.php
Last active June 14, 2022 00:13
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
@ghalimi
ghalimi / PV.js
Created January 25, 2013 23:27
PV Function
// Copyright (c) 2012 Sutoiku, Inc. (MIT License)
function PV(rate, periods, payment, future, type) {
// Initialize type
var type = (typeof type === 'undefined') ? 0 : type;
// Evaluate rate and periods (TODO: replace with secure expression evaluator)
rate = eval(rate);
periods = eval(periods);
@vodolaz095
vodolaz095 / print.js
Last active August 30, 2023 20:47
Print for NodeJS using CUPS backend
var ipp = require('ipp'); //get it from there - https://npmjs.org/package/ipp - $npm install ipp
var request = require('request'); //get it from there - https://npmjs.org/package/request - $npm install request
var fs = require('fs');
function getPrinterUrls(callback) {
var CUPSurl = 'http://localhost:631/printers';//todo - change of you have CUPS running on other host
request(CUPSurl, function (error, response, body) {
if (!error && response.statusCode == 200) {
var printersMatches = body.match(/<TR><TD><A HREF="\/printers\/([a-zA-Z0-9-^"]+)">/gm);//i know, this is terrible, sorry(
var printersUrls = [];
@codler
codler / gist:5383971
Created April 14, 2013 19:56
IRC bot, Node.js v0.6, 2011-12-15 Read and write to both irc and file. Two-way communication.
var util = require('util'),
net = require('net');
fs = require('fs');
vm = require('vm');
repl = require('repl');
var socket = new net.Socket();
socket.setNoDelay(true);
socket.setEncoding('ascii');
@tedmiston
tedmiston / nodejs-tcp-example.js
Last active February 19, 2024 21:55
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@victorb
victorb / app.js
Created September 24, 2013 16:37
Easy AngularJS Directive for Google Places Autocomplete
var myApp = angular.module('myApp', []);
myApp.directive('googleplace', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, model) {
var options = {
types: [],
componentRestrictions: {}
};