Skip to content

Instantly share code, notes, and snippets.

View cantones-cr.js
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 Sep 27, 2019 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips
View docker-help.md

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@cayasso
cayasso / component.jsx
Last active Nov 2, 2018
i18n react native
View component.jsx
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>
View order statistic tree.js
// 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 Jul 8, 2018 — forked from rrobe53/gist:976610
Node.js File Extension Content Type
View gist:ea5dbc22340285ae0da241d3d396f4a4
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"
View user.store.js
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 Aug 24, 2017
mobx user store example
View store.js
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
Bulk writes in mongoose
View index.js
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,
View flatten.js
/**
* 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 Feb 20, 2017
Select Issue in Svelte
View Select.js
<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 {