Skip to content

Instantly share code, notes, and snippets.

View carloslema's full-sized avatar

Carlos Lema carloslema

View GitHub Profile
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const incrementPlugin = store => {
store.subscribe((mutation, state) => {
if(mutation.type === "showCount") {
state.count++
}
@carloslema
carloslema / testApiKeyAndAxios.js
Created February 3, 2019 20:15 — forked from phsultan/testApiKeyAndAxios.js
Google Speech Recognition with API key + axios
const fs = require('fs');
const axios = require('axios');
const API_KEY = 'ADD YOUR API KEY HERE';
const fileName = './audio.raw';
// Reads a local audio file and converts it to base64
const file = fs.readFileSync(fileName);
const audioBytes = file.toString('base64');
@carloslema
carloslema / Firebase Database API Cheatsheet
Created April 21, 2018 16:16 — forked from odigity/Firebase Database API Cheatsheet
Firebase Database API Cheatsheet
There is no way to store an empty object/array/null value.
There are also no actual arrays. Array values get stored as objects with integer keys.
(If all keys are integers, it will be returned as an array.)
Basically, it's one giant tree of hashes with string keys.
Simply write a value to any location, and the intermediary locations will automatically come into existance.
── Classes ──
DataSnapshot : Container for a subtree of data at a particular location.
@carloslema
carloslema / jqfp.js
Created April 15, 2018 15:03 — forked from oganm/jqfp.js
Shiny user fingerprint (md5 hash of browser characteristics) and ip address demo. The .R files are in the working directory ("./"), the .js files must be placed in ./www/js/ to be accessible.
// Browser fingerprinting is a technique to "mark" anonymous users using JS
// (or other things). To build an "identity" of sorts the browser is queried
// for a list of its plugins, the screen size and several other things, then
// hashes them. The idea is that these bits of information produce an unique
// "fingerprint" of sorts; the more elaborate the list of data points is, the
// more unique this fingerprint becomes. And you wouldn't even need to set a
// cookie to recognize this user when she visits again.
//
// For more information on this topic consult
// [Ars Technica](http://arstechnica.com/tech-policy/news/2010/05/how-your-web-browser-rats-you-out-online.ars)
@carloslema
carloslema / reverse-ip-lookup.js
Created December 7, 2017 15:45 — forked from eugenehp/reverse-ip-lookup.js
node.js IP reverse lookup
var dns = require('dns');
function reverseLookup(ip) {
dns.reverse(ip,function(err,domains){
if(err!=null) callback(err);
domains.forEach(function(domain){
dns.lookup(domain,function(err, address, family){
console.log(domain,'[',address,']');
console.log('reverse:',ip==address);
@carloslema
carloslema / LICENSE
Created January 24, 2016 23:32 — forked from chriseidhof/LICENSE
A tiny networking library
Copyright 2015 Chris Eidhof
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHE
@carloslema
carloslema / Query.swift
Created December 24, 2015 10:59 — forked from galiak11/ Query.swift
Swift CoreData Query API
import Foundation
import CoreData
/**
Query: this is a Swift Query API for CodeData.
Usage example:
// fetch multiple rows
let people = Query("Person").whereEqual( "lastName", lastName ).sort( "name" ).fetch()