Skip to content

Instantly share code, notes, and snippets.

View pandres95's full-sized avatar
🦕
Writing a book: The Deno Encyclopedia

Pablo Andrés Dorado Suárez pandres95

🦕
Writing a book: The Deno Encyclopedia
View GitHub Profile
@pandres95
pandres95 / app.js
Last active August 29, 2015 14:06
MongoDB multiple models import
var mongoose = require('mongoose'),
// Import de modelos y registro en mongoose
require('./user');
/*
require('./dog');
require('./enterprise');
···
*/
@pandres95
pandres95 / index.html
Created September 12, 2014 16:56
Game
<!DOCTYPE hmtl>
<html>
<head>
<meta charset="utf-8" />
<title>Mi juego</title>
<style>
#micanvas {
background: #000;
}
</style>
@pandres95
pandres95 / array_separator.js
Last active August 29, 2015 14:08
Separates arrays into groups of two values
_ = require('underscore');
function doubled(list, newL) {
if(!newL) newL = [];
return list.length == 0 ?
newL :
doubled(
_.tail(list, 2),
_.union(newL, [_.head(list, 2)])
package comando;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
@pandres95
pandres95 / mockup.jpg
Last active August 29, 2015 14:17
Maqueta IBG.js
mockup.jpg
@pandres95
pandres95 / regex.js
Created April 8, 2015 00:12
Diff-style separate files
module.exports = {
upside: /([^\<\<\<\<\<\<\< HEAD\n])([\s\S]+)(?=\=\=\=\=\=\=\=)/,
downside: /(\=\n)([\s\S]+)(?=\>\>\>\>\>\>\>)/
};
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="co.gov.inci.evaluon.gui.controllers.settings.HelpActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
#include <cstdlib>
#include <iostream>
using namespace std;
void promptData(
int* numberOfSubjects,
int* creditsSubject1, int* creditsSubject2,
int* creditsSubject3, int* creditsSubject4,
int* weeklyClassHours
@pandres95
pandres95 / mongoose_updater.js
Last active April 6, 2016 08:37
Update single document in mongoose
var Q = require('q')
, _ = require('underscore');
schema.statics.updateDocument = function(id, data){
return Q.nbind(this.findOne, this)({ _id: id }).then(document => {
_.chain(data).omit([ '_id', '__v' ]).map((value, key) => {
if(document.hasOwnProperty(key)) {
this[key] = value;
}
});
@pandres95
pandres95 / dao-client.js
Last active May 24, 2016 15:27
Standard mean to authenticate in bool.js (or anywhere. You just need oauth2orize and passportjs)
'use strict';
module.exports = function (app) {
var client = new app.models.Client();
this.list = function (req) { var query = req || {};
return client.list(query.search, query.fields, query.projection);
};
this.find = function (id) {