Skip to content

Instantly share code, notes, and snippets.

View xalakox's full-sized avatar
🗺️
Working from anywhere

Salvador Aceves Osuna xalakox

🗺️
Working from anywhere
View GitHub Profile
const { equals } = require('expect/build/jasmineUtils');
expect.extend({
toContainObject(received, argument) {
const pass = (() => {
if (Array.isArray(argument)) {
return equals(received,
expect.arrayContaining(argument.map(arg => expect.objectContaining(arg)))
);
}
### Keybase proof
I hereby claim:
* I am xalakox on github.
* I am xalakox (https://keybase.io/xalakox) on keybase.
* I have a public key ASCRbSiHwJ6Mr6gHbg7Pji1a6AEn6ZcI4raErwtL7leFlAo
To claim this, I am signing this object:
@xalakox
xalakox / gist:d27622e1907c45f77b24849862afd90f
Created March 7, 2018 17:32
promise time debug function
const timePromise = (fn, fnName) => {
console.time(fnName)
return eval(fn).then((retval)=>{
console.timeEnd(fnName)
return retval
})
}
@xalakox
xalakox / esnextbin.md
Last active May 10, 2017 15:28
esnextbin sketch
@xalakox
xalakox / esnextbin.md
Last active April 24, 2017 23:15
esnextbin sketch
@xalakox
xalakox / knight_chessboard.js
Last active January 28, 2017 16:53
Kight Problem: ¿ How many moves to reach a destination using the knight on a infinite sized chessboard ?
#!/usr/bin/env node
function solution(A, B) {
moves = [[2,1],[2,-1],[-2,1],[-2,-1],[-1,+2],[+1,+2],[-1,-2],[+1,-2]]
maxmoves = ~~(A*B/4) || 3
finaldestinations = []
trymove = function(startx,starty,priormoves){
priormoves++;
possiblemoves = moves.filter(function(move){
return startx + move[0] > -1 && starty + move[1] > -1
});

Swagger

Dockerfile

FROM node:4
RUN apt-get -y update && npm install -g coffee-script && npm install -g forever && npm install -g nodemon && npm install swagger -g

WORKDIR /app
# ADD package.json /app/
# ADD config.json /app/
# RUN npm install
@xalakox
xalakox / 0_reuse_code.js
Created March 31, 2016 20:36
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#!/bin/sh
awk -F',' '/EXTINF/ {canal=$NF; gsub(/ /,"_",canal); getline url; print canal;print "shoot.sh " canal " " url}' canales.m3u