Skip to content

Instantly share code, notes, and snippets.

View junosuarez's full-sized avatar
💭
hi hello

juno suárez junosuarez

💭
hi hello
View GitHub Profile
Information is power. But like all power, there are those who want to keep it for themselves. The world’s entire scientific and cultural heritage, published over centuries in books and journals, is increasingly being digitized and locked up by a handful of private corporations. Want to read the papers featuring the most famous results of the sciences? You’ll need to send enormous amounts to publishers like Reed Elsevier.
There are those struggling to change this. The Open Access Movement has fought valiantly to ensure that scientists do not sign their copyrights away but instead ensure their work is published on the Internet, under terms that allow anyone to access it. But even under the best scenarios, their work will only apply to things published in the future. Everything up until now will have been lost.
That is too high a price to pay. Forcing academics to pay money to read the work of their colleagues? Scanning entire libraries but only allowing the folks at Google to read them? Providing scientific a
@junosuarez
junosuarez / gist:4688640
Created February 1, 2013 02:16
_.last predicate signature use case
//rather than:
var title = '';
for(var i = things.length-1; i >= 0; i--) {
title = things[i].title;
if (title) {
break;
}
}
({
baseUrl: './src/',
dir: 'build',
include: ['main'],
logLevel: 0,
mainConfigFile: './src/main.js',
name: 'main',
wrap: false,
optimize: 'none',
preserveLicenseComments: false
PS C:\dev\scs\test> scriptcs server.csx
Found package reference: C:\dev\scs\test\packages\Microsoft.AspNet.WebApi.Client.4.0.20710.0\lib\net40
Found package reference: C:\dev\scs\test\packages\Microsoft.AspNet.WebApi.Core.4.0.20710.0\lib\net40
Found package reference: C:\dev\scs\test\packages\Microsoft.AspNet.WebApi.SelfHost.4.0.20918.0\lib\net40
Found package reference: C:\dev\scs\test\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40
Found package reference: C:\dev\scs\test\packages\Newtonsoft.Json.4.5.11\lib\net35
Found package reference: C:\dev\scs\test\packages\Newtonsoft.Json.4.5.11\lib\net40
Listening...
@junosuarez
junosuarez / gist:5149561
Created March 13, 2013 05:20
What's the best way to build a function with prototypically inherited properties which still evaluates to typeof => 'function'?
var proto = {foo: true}
var f1 = Object.create(proto, function () { return 1 })
f1() // => 1
f1.foo // => true
// :)
typeof f1 // => 'object'
// :(
var f2 = function () { return 2 })
@junosuarez
junosuarez / gist:5201918
Last active December 15, 2015 04:29
the database script used to pick a winner for the showfort.com VIP pass giveaway.
// all right showfortians, let's pick a winner! here's the actual source code:
// first let's load our database driver & connect to it:
var minq = require('minq')
minq.connect(process.env.CONNECTION_STRING)
// in order to be eligible, you need to have favorited at least one show
// and not be one of my own accounts
var eligible = {
'faves.shows': {$not: {$size: 0}},
// using Deferreds
function delay(value, timeout) {
var deferred = Q.defer()
if (typeof timeout !== 'number') {
deferred.reject(new TypeError('timeout must be a number'))
} else {
setTimeout(function () {
deferred.resolve(value)
@junosuarez
junosuarez / JSDoc example.js
Created April 5, 2013 06:19
JSDoc vs jsig - callbacks
// from http://usejsdoc.org/tags-callback.html
//// Documenting a class-specific callback
/**
* @class
*/
function Requester() {}
/**
* Send a request.
@junosuarez
junosuarez / gist:5394373
Created April 16, 2013 08:38
Explanation of liftA2 in JavaScript via http://www.techtangents.com/explanation-of-lifta2-in-javascript/ with examples rewritten in jsig

This came out of the recent JS Promises debate. @ForbesLindesay was confused by liftA2, so I thought I’d try to explain it.

Let me explain liftA2. I’ll tweak @pufuwozu’s examples so that they return values.

// Promises (called when both succeed)
liftA2(readFIle('hello.txt'), readFile('world.txt'), function(hello, world) {
 return hello + ' ' + world;
});
// Optional values (only inserted into database when both exist)

liftA2(optionalUsername, optionalPassword, function(username, password) {

@junosuarez
junosuarez / Keep on Crossin Manifesto.md
Last active December 16, 2015 12:19
My translation of the Keep on Crossin manifesto http://www.keeponcrossin.com/manifesto.htm

When in the course of human events it becomes necessary to cross borders of political, social, linguistic, cultural, economic, and technological construction, we will cross them. Long before there were borders, there were crossers. We are the proud sons and daughters of those crossers, and we maintain that crossing is a fundamental human right. Moreover, we maintain that is right is inalienable.

We reject the artificial borders of the body and mind and spirit. For every trans-human, trans-gressor, trans-vestite, and transcendant living in the crossroads of culture, it is now time to cross.

We live in an age when drums of toxic waste has more right to cross than a human being. Whenever and wherever this is the case, we shall cross.

Our crossing will be a signal for other crossers that now is the time to cross. We'll do so at the crossings, but wherever we cross will become a crossing by the very act of our crossing. Before doing so, we will look both ways. Then, with the positive human spirit, we will cross