Skip to content

Instantly share code, notes, and snippets.

View alesanabv's full-sized avatar

Alejandro Sanabria alesanabv

  • Bogotá, Colombia
  • 07:00 (UTC -05:00)
View GitHub Profile
@alesanabv
alesanabv / quill_editor.js
Created December 8, 2016 23:59
quill editor react component
'use strict';
import React from 'react';
import Quill from 'quill';
import uid from 'uid';
export default React.createClass({
getInitialState() {
return {
id: `editor-${ uid() }`,
idToolbar: `toolbar-${ uid() }`,
function registerTranslations() {
$trans = get_option('translations');
$translations = explode('|', $trans);
$group = 'bs_';
foreach($translations as $str) {
pll_register_string($str, $str, $group, true);
}
}
@alesanabv
alesanabv / fun.js
Created November 24, 2016 01:02
my own functional lib, only for learning
'use strict';
export const each = fn => arr => Array.prototype.forEach.call(arr, fn);
export const map = fn => arr => Array.prototype.map.call(arr, fn);
export const reduce = (fn, initial = {}) => arr => Array.prototype.reduce.call(arr, fn, initial);
export const on = (event, fn) => el => el.addEventListener(event, fn);
@alesanabv
alesanabv / dollar.compiled.js
Last active November 7, 2016 03:35
my own DOM manipulation lib, cause, why not?
'use strict';
var each = function each(fn) {
return function (arr) {
return Array.prototype.forEach.call(arr, fn);
};
};
var map = function map(fn) {
return function (arr) {
return Array.prototype.map.call(arr, fn);
module.exports = {
watch: true,
entry: {
app: './client/app.js',
admin: './client/admin/app.js'
},
output: {
path: './public/js',
filename: '[name].js'
},
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "shift+cmd+d",
"command": "editor.action.copyLinesDownAction"
},
{
"key": "shift+alt+p",
"command": "workbench.action.git.push"
},
mongoexport --db calendar --collection users --type=csv --fields name,lastname,email,mobile,phone,position --out users.csv
function getCapture(red, green, blue, gradientPosition, gcolor1, gcolor2) {
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.drawImage(video, 0, 0);
var imgData = ctx.getImageData(0, 0, canvas.width, canvas.height);
imgData = setRgb(imgData, red, green, blue);
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
c.width = 500;
c.height = 500;
function createCircles(x, y, r) {
ctx.fillStyle = "#012754";
ctx.beginPath();
function extend(a, b) {
for( var key in b ) {
if( b.hasOwnProperty( key ) ) {
if(typeof b[key] === "object") {
a[key] = extend(a[key], b[key]);
}
else {
a[key] = b[key];
}