Skip to content

Instantly share code, notes, and snippets.

Avatar
🐪
Working from anywhere

Salvador Aceves Osuna xalakox

🐪
Working from anywhere
View GitHub Profile
View jest.setup.js
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)))
);
}
View gist:8d20259ab93584c798cbdeff179471d0
### 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 / couchdb csv list
Created Jun 30, 2012
CouchDB JSON to CSV view converter use ?include_docs=true&reduce=false
View couchdb csv list
{
"csv":"function(head, req){
start({
'headers': {
'Content-Type': 'text/csv'
}
});
Array.prototype.unique = function() {
var a = this.concat();
View gist:d27622e1907c45f77b24849862afd90f
const timePromise = (fn, fnName) => {
console.time(fnName)
return eval(fn).then((retval)=>{
console.timeEnd(fnName)
return retval
})
}
@xalakox
xalakox / knight_chessboard.js
Last active Jan 28, 2017
Kight Problem: ¿ How many moves to reach a destination using the knight on a infinite sized chessboard ?
View knight_chessboard.js
#!/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
});
View swagger_docker.md

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 Mar 31, 2016
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 awk.sh
#!/bin/sh
awk -F',' '/EXTINF/ {canal=$NF; gsub(/ /,"_",canal); getline url; print canal;print "shoot.sh " canal " " url}' canales.m3u