Skip to content

Instantly share code, notes, and snippets.

everything happens so much oh no

Quil robotlolita

everything happens so much oh no
Block or report user

Report or block robotlolita

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 ValidarFormularioNovo.js
const Validation = require('folktale/validation');
const { Success, Failure } = Validation;
// valida se uma string não é vazia
const hasText = (value, name) =>
if (value != "") Success(value)
else Failure([{ code: 'required', name }]);
// valida se uma selecao não é vazia
const hasSelection = (value, name) =>

Unclutter calendar:

javascript:void (() => { Array.from(document.querySelectorAll('.calendar .item')).filter(x => !/\b(green|yellow)\b/.test(x.className)).forEach(x => x.parentNode.removeChild(x)); Array.from(document.querySelectorAll('.browse__content .section')).filter(x => { const a = x.querySelector('h2'); return x.textContent.trim() === a.textContent.trim() }).forEach(x => x.parentNode.removeChild(x)) })()
View key-gen.js
var fs = require("fs");
var helpers = require("./helpers");
var path = require("path");
function readFile(path, options) {
return new Promise(function(resolve, reject) {
fs.readFile(path, options, function(err, data) {
if (err) reject(err);
else resolve(data);
View promises.js
'use strict';
var promise = {
state: 'pending',
value: null,
dependencies: [],
then: function(expression) {
View 0-callbacks.js
var async = require('async');
async.eachSeries(array, function(item, callback){
callAsyncFunction(item, function(error, data) {
if (error) {
return callback(error);
} else {
async.eachSeries(arrayTwo, function(sItem, sCallback) {
callAnotherAsyncFunction(item + sItem, function(error, data) {
robotlolita / 0_reuse_code.js
Created Nov 4, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View 3. Promises way.
// Logic MUST BE identical to the synchronous way:
var mongoose = require('mongoose');
var collectionASchema = new mongoose.Schema({field1: Number, field2: Number});
var collectionBSchema = new mongoose.Schema({field1: Number, field2: Number});
collectionASchema.index({field1: 1});
collectionBSchema.index({field1: -1});
mongoose.model('collectionA', collectionASchema);
mongoose.model('collectionB', collectionBSchema);
robotlolita /
Last active Aug 28, 2015 — forked from joepie91/map.js
Bluebird map + bhttp
(* Assume bhttp-get is available here somehow *)
let HTTP = {
def get: url
(* This would actually need to be imported properly. Yeah, FFI sucks, but oh well... *)
Task from-promise: (FFI invoke: bhttp-get in-context: unit with-arguments: [FFI export: url])
do {
response <- HTTP get: "";
View a.js
exports.commands = {
mb: 'musicbox',
musicbox: function (target, room, user) {
if (!this.canBroadcast()) return;
var parts = target.split(',');
if (!target) return this.sendReply("/musicbox link, link, link - parses it to be in a music box");
var parsedParts =;
Promise.all(parsedParts).then(function(parts) {
var str = parts.join('');
this.sendReply('str is ' + str);
View promises.js
function pipeline(fs, val, done) {
if (fs.length === 0) done(null, val)
else fs[0](val, function(err, val) {
if (err) done(err)
else pipeline(fs.slice(1), val, done)
You can’t perform that action at this time.