Skip to content

Instantly share code, notes, and snippets.

Juan Pablo Contreras Franco jpcofr

Block or report user

Report or block jpcofr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View map_to_ctrl.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,00,00,3a,00,00,00,00,00
0000 0000 0000 0000 0200 0000 1d00 3a00 0000 0000
@jpcofr
jpcofr / d3-server.js
Last active Aug 2, 2017 — forked from caged/d3-server.js
Directly render and serve d3 visualizations from a nodejs server.
View d3-server.js
// Start `node d3-server.js`
// Then visit http://localhost:1337/
//
var d3 = require('d3'),
http = require('http'),
jsdom = require('jsdom/lib/old-api'),
fs = require('fs'),
xmldom = require('xmldom');
http.createServer(function (req, res) {
@jpcofr
jpcofr / d3_svg_server_rendering.js
Created Aug 2, 2017
Renders an svg circle at server side
View d3_svg_server_rendering.js
var fs = require('fs');
var d3 = require('d3')
require('jsdom-global')()
var body = document.querySelector('body')
d3.select(body)
.append('svg:svg')
.attr('xmlns', 'http://www.w3.org/2000/svg')
.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink')
@jpcofr
jpcofr / test_filesystem_IO.js
Created Aug 2, 2017
Example of filesystem IO using nodejs
View test_filesystem_IO.js
var fs = require('fs');
fs.writeFile("./hi.txt", "I wrote a file, I liked it!", function (err) {
if (err) {
return console.log(err);
}
console.log("The file was saved!");
});
@jpcofr
jpcofr / download_gists.js
Created Aug 2, 2017 — forked from thomastraum/download_gists.js
Gist to download all your gists
View download_gists.js
var request = require('request')
, path = require('path')
, fs = require('fs')
, url = "https://api.github.com/users/thomastraum/gists"
, savepath = './gists';
request(url, function (error, response, body) {
if (!error && response.statusCode == 200) {
View create_nodejs_server.js
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {
'Content-Type': 'text/plain'
});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
@jpcofr
jpcofr / node_server.js
Last active Aug 2, 2017
Publishes a file from the filesystem on a webpage
View node_server.js
var jsdom = require('jsdom')
var fs = require('fs');
var http = require('http');
require('jsdom-global')() // Allows to use global dom documents inside node
// Read the file and adds the content to the
fs.readFile('./the_file.svg', function read(err, data) {
if (err) {
throw err;
@jpcofr
jpcofr / pre-render.js
Created Aug 2, 2017 — forked from mef/pre-render.js
proof-of-concept pre-rendering d3.js svgs on the server using node.js and jsdom module.
View pre-render.js
// pre-render d3 charts at server side
var d3 = require('d3')
, jsdom = require('jsdom')
, fs = require('fs')
, htmlStub = '<html><head></head><body><div id="dataviz-container"></div><script src="js/d3.v3.min.js"></script></body></html>'
jsdom.env({
features : { QuerySelector : true }
, html : htmlStub
, done : function(errors, window) {
@jpcofr
jpcofr / hosts
Last active Feb 2, 2017
Hosts file to prevent computer connecting to undesired sites
View hosts
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#
# See below for acknowledgements.
# Please forward any additions, corrections or comments by email to
# hosts@someonewhocares.org
@jpcofr
jpcofr / homework.cls
Last active Oct 8, 2015 — forked from jhwilson/jhwhw.cls
Document class for Homework assignments
View homework.cls
%=====================================================================
% jhwhw.cls
% Provide jhwhw.cls class
%=====================================================================
%=====================================================================
% Identification
%=====================================================================
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{homework}[2015/02/11 Homework Class]
You can’t perform that action at this time.