Skip to content

Instantly share code, notes, and snippets.

const districts = [
{ code: 10101, p: 'San José', c: 'San José', d: 'Carmen' },
{ code: 10102, p: 'San José', c: 'San José', d: 'Merced' },
{ code: 10103, p: 'San José', c: 'San José', d: 'Hospital' },
{ code: 10104, p: 'San José', c: 'San José', d: 'Catedral' },
{ code: 10105, p: 'San José', c: 'San José', d: 'Zapote' },
{ code: 10106, p: 'San José', c: 'San José', d: 'San Francisco de Dos Ríos' },
{ code: 10107, p: 'San José', c: 'San José', d: 'Uruca' },
{ code: 10108, p: 'San José', c: 'San José', d: 'Mata Redonda' },
{ code: 10109, p: 'San José', c: 'San José', d: 'Pavas' },
@cayasso
cayasso / docker-help.md
Created September 27, 2019 00:29 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@cayasso
cayasso / component.jsx
Last active November 2, 2018 19:00
i18n react native
import React from 'react'
import { Text, View } from 'react-native'
import i18n from 'lib/i18n
const name = 'Norman Ramirez'
export default () => (
<View>
<Text>{i18n`Hi how are you ${name}`}</Text>
<Text>{i18n`I am fine`}</Text>
// Use: var tree = new OST(); tree.select(4); tree.insert(key,value)
var OST = function () {
// Order statistic tree node
var Node = function (leftChild, key, value, rightChild, parent) {
return {
leftChild: (typeof leftChild === "undefined") ? null :
leftChild,
key: (typeof key === "undefined") ? null : key,
value: (typeof value === "undefined") ? null : value,
rightChild: (typeof rightChild === "undefined") ? null :
@cayasso
cayasso / gist:ea5dbc22340285ae0da241d3d396f4a4
Created July 8, 2018 01:26 — forked from rrobe53/gist:976610
Node.js File Extension Content Type
exports.ext = function () {
var extTypes = {
"3gp" : "video/3gpp"
, "a" : "application/octet-stream"
, "ai" : "application/postscript"
, "aif" : "audio/x-aiff"
, "aiff" : "audio/x-aiff"
, "asc" : "application/pgp-signature"
, "asf" : "video/x-ms-asf"
, "asm" : "text/x-asm"
@cayasso
cayasso / user.store.js
Created August 24, 2017 16:56
mobx user store
import { observable, extendObservable } from 'mobx'
import * as storage from '../../utils/local-storage'
import config from '../../config'
import * as api from './api'
const defaults = {
sub: null,
email: null,
mail_verified: null
}
@cayasso
cayasso / store.js
Created August 24, 2017 16:52
mobx user store example
import { toJS, action, observable, extendObservable } from 'mobx'
import { setToken, unsetToken } from 'lib/api'
import * as storage from 'lib/localstorage'
import * as tokenStorage from 'lib/token'
import { omit } from 'lib/utils'
import sleep from 'lib/sleep'
import * as api from 'user/api'
let store = null
@cayasso
cayasso / index.js
Created May 30, 2017 20:10
Bulk writes in mongoose
const mongoose = require('mongoose')
const { Types, Schema } = mongoose
// Connect to mongo
mongoose.connect('mongodb://localhost/bulk');
// Set model schema
const ArticleSchema = new Schema({
title: {
type: String,
@cayasso
cayasso / flatten.js
Created February 28, 2017 00:03
flatten
/**
* Takes a deeply nested object, `source`, and returns an object with
* dot-separated paths pointing to all primitive values from `source`.
*/
const keys = Object.keys
const isArray = Array.isArray
function flatten(source) {
let total = {}
@cayasso
cayasso / Select.js
Created February 20, 2017 22:56
Select Issue in Svelte
<select ref:select on:change="doChange(event)">
<option value="{{item.key}}">{{item.title}}</option>
<option value="two">Two</option>
<option value="three">Three</option>
</select>
<div>Selected Value: {{value}}</div>
<script>
export default {