Skip to content

Instantly share code, notes, and snippets.

View Rolilink's full-sized avatar

Rolando Perez Rolilink

View GitHub Profile
const sum = (n1, n2) => (n1 + n2);
describe('#sum', () => {
it('should add both numbers', () => {
expect(sum(1,2)).toMatchSnapshot();
});
});
{
total: 151540, // esto es accountBalance
funds:
[
{ category: 'userFunds', amount: 9000 },
{ category: 'pendingPayments', amount: 6000 },
{ category: 'workingCapital', amount: 60770 }
],
lastUpdated: 2017-08-02T21:06:35.700Z,
numericFormat: 'pennies',
{
"answer": {
"text": "Persona a tu izquierda.",
"type": "answer",
"id": 116,
"answers": 0
},
"keen": {
"timestamp": "2017-07-26T03:16:18.688Z",
"created_at": "2017-07-26T03:16:18.688Z",
# Saving a product from database
product = ShopifyAPI::Product.find(179761209) # This does an get http request to shopify api
db_product = DBProduct.new # You have to create a new rails model
db_product.shopify_id = product.id
db_product.save
# Saving a product to shopify
product.title = 'changed'
product.save # updates product in shopify, http put request
@Rolilink
Rolilink / test.js
Created October 1, 2015 20:21
voyage class
'use strict';
var expect = require('chai').expect;
var Voyage = require('../../lib/resources/voyage.js');
var _ = require("underscore");
describe('Voyage Class', function(){
it('should have a method called getVoyages', function(){
expect(Voyage.getVoyages).to.be.a('function');
var model1 = new Model();
var model2 = new Model();
model1.save(function(){
doSomething(model1); // get executed only when model1 is saved
}); // Kinda slow
model2.save(function(){
doSomething(model2); // get executed only when model2 is saved
}); // Kinda slow
var model1 = new Model();
var model2 = new Model();
model1.save(); // Kinda slow
doSomething(model1);
model2.save(); // Kinda slow
doSomething(model2);
@Rolilink
Rolilink / Dockerfile
Created February 2, 2015 18:47
app container
# LoopBack App Base Image
FROM 4dstudios/loopback_app_base
# Create App Directory and CD into it
RUN mkdir /data/app
WORKDIR /data/app
# Clone Master and Install dependencies
RUN git clone https://github.com/Rolilink/remote-job-board.git
@Rolilink
Rolilink / Dockerfile
Last active August 29, 2015 14:14
loopback-git-base Dockerfile
# LoopBack App Base Image
# Installs StrongLoop and Git
FROM dockerfile/nodejs
#Installing Loopback
RUN npm install -g strongloop
# Installing Git
RUN mkdir /data/git-tmp
WORKDIR /data/git-tmp
/**
* Remove diacritics (accent and other marks) on characters, and dissociate double characters.
* Based on the character map of http://lehelk.com/2011/05/06/script-to-remove-diacritics/
* but per-character walk (improved performance).
*
* Licensed under WTFPL v2 http://sam.zoy.org/wtfpl/COPYING
*/
var removeDiacritics = (function() {
var diacritics = {"\u24B6":"A","\uFF21":"A","\u00C0":"A","\u00C1":"A","\u00C2":"A","\u1EA6":"A","\u1EA4":"A","\u1EAA":"A","\u1EA8":"A","\u00C3":"A","\u0100":"A","\u0102":"A","\u1EB0":"A","\u1EAE":"A","\u1EB4":"A","\u1EB2":"A","\u0226":"A","\u01E0":"A","\u00C4":"A","\u01DE":"A","\u1EA2":"A","\u00C5":"A","\u01FA":"A","\u01CD":"A","\u0200":"A","\u0202":"A","\u1EA0":"A","\u1EAC":"A","\u1EB6":"A","\u1E00":"A","\u0104":"A","\u023A":"A","\u2C6F":"A","\uA732":"AA","\u00C6":"AE","\u01FC":"AE","\u01E2":"AE","\uA734":"AO","\uA736":"AU","\uA738":"AV","\uA73A":"AV","\uA73C":"AY","\u24B7":"B","\uFF22":"B","\u1E02":"B","\u1E04":"B","\u1E06":"B","\u0243":"B","\u0182":"B","\u0181":"B",