Skip to content

Instantly share code, notes, and snippets.

View betacar's full-sized avatar
🤓
Tidsoptimist

Carlos Betancourt Carrero betacar

🤓
Tidsoptimist
View GitHub Profile
@betacar
betacar / index.html
Last active April 19, 2019 23:14
Arra#includes vs. Set#has #jsbench #jsperf (http://jsbench.github.io/#c5729bf11396f9577e90fa42964e13ea) #jsbench #jsperf
<!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>

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 November 7, 2017 15:49
NuxtJS plugin to integrate FeathersJS and VueJS
'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';
@betacar
betacar / config.xml
Created January 3, 2012 20:19
Mediatomb configuration file + subtitle script
<?xml version="1.0" encoding="UTF-8"?>
<config version="2" xmlns="http://mediatomb.cc/config/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mediatomb.cc/config/2 http://mediatomb.cc/config/2.xsd">
<!--
Read /usr/share/doc/mediatomb-common/README.gz section 6 for more
information on creating and using config.xml configration files.
-->
<server>
<ui enabled="yes" show-tooltips="yes">
<accounts enabled="no" session-timeout="30">
<account user="mediatomb" password="mediatomb"/>
@betacar
betacar / binary-search.rb
Created February 11, 2017 20:29
Algorithms
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
@betacar
betacar / index.html
Created December 19, 2016 16:15
Date.now() vs. +new Date() (http://jsbench.github.io/#45f153b0c2561bb337ea1a088262b5d7) #jsbench #jsperf
<!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 December 9, 2016 19:39
String concatenation vs. interpolation (http://jsbench.github.io/#70dcc32e344391ba889afbec96fb99e0) #jsbench #jsperf
<!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 February 11, 2016 20:29
Transform images to base64 strings
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
@betacar
betacar / elefantes.rb
Last active December 21, 2015 20:39 — forked from GusGA/elefantes.rb
i = 1
loop {
if i == 1
p "1 elefante se balanceaba sobre la tela de una araña, como veia que resistía fue a llamar a otro elefante"
else
p "#{i} elefantes se balanceaban sobre la tela de una araña, como veian que resistía fueron a llamar a otro elefante"
end
i += 1
sleep 5
}
<snippet>
<content><![CDATA[
describe '${1:description}' do
${2}
end
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>describe</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.ruby</scope>