Skip to content

Instantly share code, notes, and snippets.

Avatar

Carlos Betancourt Carrero betacar

View GitHub Profile
@betacar
betacar / index.html
Last active Apr 19, 2019
Arra#includes vs. Set#has #jsbench #jsperf (http://jsbench.github.io/#c5729bf11396f9577e90fa42964e13ea) #jsbench #jsperf
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Arra#includes vs. Set#has #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
View keybase.md

Keybase proof

I hereby claim:

  • I am betacar on github.
  • I am betacar (https://keybase.io/betacar) on keybase.
  • I have a public key ASDzsG0GgvjrU1LKiEDdpVDZyi_KDJBQ3seYAM1Rmrfy1Qo

To claim this, I am signing this object:

@betacar
betacar / vue-feathers.js
Last active Nov 7, 2017
NuxtJS plugin to integrate FeathersJS and VueJS
View vue-feathers.js
'use strict';
import Vue from 'vue';
import Feathers from 'feathers/client';
import VueFeathers from 'vue-feathers';
import hooks from 'feathers-hooks';
import authentication from 'feathers-authentication/client';
// import rest from 'feathers-rest/client';
import rx from 'feathers-reactive';
import RxJS from 'rxjs';
View binary-search.rb
require 'benchmark'
Benchmark.bm do |bm|
def binary_search arr, target
med = (arr.length / 2).to_i
return false if med == 1
val = arr[med]
return true if val == target
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Date.now() vs. +new Date()</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@betacar
betacar / index.html
Created Dec 9, 2016
String concatenation vs. interpolation (http://jsbench.github.io/#70dcc32e344391ba889afbec96fb99e0) #jsbench #jsperf
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>String concatenation vs. interpolation</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@betacar
betacar / image-to-base64.js
Last active Feb 11, 2016
Transform images to base64 strings
View image-to-base64.js
const fs = require('fs');
const regex = /(\.|\/)(gif|jpe?g|png|txt)$/i;
const dir = './';
const encoding = 'base64';
fs.readdir(dir, (err, files) => {
if (err) return err;
files.forEach((file) => {
// Skip current file
View console-coffee.sublime-snippet
<snippet>
<content><![CDATA[
console.log '######################################################################'
console.log '$1', $2
console.log '######################################################################'
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>console</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.coffee</scope>
View package-control-settings.json
{
"in_process_packages": [],
"installed_packages": [
"Alignment",
"Better CoffeeScript",
"Better RSpec",
"CoffeeCompile",
"Emmet",
"GitGutter",
"HTML Mustache",
@betacar
betacar / collatz_conjecture.js
Last active Aug 29, 2015
Famous math problems
View collatz_conjecture.js
var collatz = function(n) {
var result;
console.log(n);
result = n % 2 == 0 ? n/2 : 3 * (n + 1);
return collatz(result);
};
You can’t perform that action at this time.