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';
@betacar
betacar / config.xml
Created Jan 3, 2012
Mediatomb configuration file + subtitle script
View config.xml
<?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"/>
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 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
}
View describe.sublime-snippet
<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>
You can’t perform that action at this time.