Skip to content

Instantly share code, notes, and snippets.

@soarez
soarez / sz.pub
Last active Aug 29, 2015
My PGP key
View sz.pub
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.14 (GNU/Linux)
mQENBFMzIewBCACqQipnUvGBhU8XTaHVDiz3yP9BJOZPyWFhuRQx/W9bDQoM5ina
NI7k9bKUdtGZVLl3jbZR2fxh/BE8lp6qA0qXrZbVMqocbH9Ih19TSA/116klV9MK
nj758sbMHfvcQpGMaxM7il9iKzn71s39opslA2UHQ6R7cukGJTpFihwNo4EhoN5j
tnui6grJkoVQQ8Jsh4bjZOTmqUHfojvGicPzQ+C5hxeBEH9h7HlC4XVYQ+Na/dvN
hMBFiFJIAalAa4E3IYuHMbNqgxSdRznR3q9j2nx60+pzwNkJfk5vWLSkNTbSzz8f
YzAJP6unTeVuKveyXurPvuoNZW8oaWaejSafABEBAAG0Iklnb3IgU29hcmV6IDxp
Z29yc29hcmV6QGdtYWlsLmNvbT6JATgEEwECACIFAlMzIewCGwMGCwkIBwMCBhUI
View model.js
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');
var Schema = mongoose.Schema;
var PageSchema = Schema({
title: { type: String, default: '', trim: true },
url: { type: String, default: '', trim: true },
thumbnails: {type: Schema.ObjectId, ref: 'Thumbnail'},
});
@soarez
soarez / check.js
Created Jun 10, 2014
Match elements from two arrays according to a specific criteria and obtain missing and extraneous elements.
View check.js
var known = [ 1, 6, 3, 9, 4 ];
var presented = [ 2, 5, 7, 4, 9, 4 ];
check(known, presented, match, done);
function match(k, p) {
if( k !== p) return false;
console.log(k, 'matched with', p);
return true;
}
@soarez
soarez / main.rs
Created Jul 9, 2014
a non working tcp chat server in Rust
View main.rs
use std::io::{Listener, Acceptor};
use std::io::net::ip::{Ipv4Addr, SocketAddr};
use std::io::net::tcp::{TcpListener, TcpStream};
use std::io::BufferedStream;
struct Client {
id: u16,
stream: BufferedStream<TcpStream>
}
View dickson-storage.js
(function() {
var ds = window.dicksonStorage = { };
var data = getData();
var INTERVAL = 400;
setInterval(ianWorker, INTERVAL);
ds.clear = clear;
function clear() {
@soarez
soarez / session-cookie-storage.js
Created Aug 11, 2014
Session storage based on session cookies
View session-cookie-storage.js
View keybase.md

Keybase proof

I hereby claim:

  • I am soarez on github.
  • I am soarez (https://keybase.io/soarez) on keybase.
  • I have a public key whose fingerprint is 39E3 D1D6 8DE7 9E7C 38FC FDD0 E92F 5809 1C19 87ED

To claim this, I am signing this object:

@soarez
soarez / ip-to-country-code.js
Created Sep 29, 2014
Query maxmind geolite2 country ( ISO_3166 ) downloadable db
View ip-to-country-code.js
var mmdbreader = require('maxmind-db-reader');
module.exports = Open;
function Open(dbPath) {
var db;
var queued = [];
mmdbreader.open(dbPath, dbReady);
return query;
@soarez
soarez / mocha-test.js
Created Oct 17, 2014
Node > Selenium > Phantom
View mocha-test.js
/*
First:
$ brew install selenium-server-standalone phantomjs
Have selenium standalone running on a separately:
$ selelium-server
*/
View cookie-storage.js
You can’t perform that action at this time.