Skip to content

Instantly share code, notes, and snippets.

View gbrian's full-sized avatar
🏠
Working from home

Gustavo Brian gbrian

🏠
Working from home
View GitHub Profile
# Repo to deploy
export GIT_CLONE_REPO=$1
# Fix debian
apt update
apt-get install --reinstall build-essential
# Install git
apt install -y git
apt-get update
apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common -y
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
function SongKickHotel(){
this.events = [];
}
SongKickHotel.prototype = {
buildHotelButton: function(href){
return $(`<a href="${href}" target="_blank">
<span class="button buy-tickets" style="
background: url('https://www.trivago.es/favicon.ico') no-repeat;
background-color: #27335f;
padding-left: 14px;
@gbrian
gbrian / trello-gamification.js
Last active March 15, 2018 07:17
Trello gamification
/**
* REFERENCES
* - https://www.cssscript.com/demo/pure-css-circular-percentage-bar/
* - http://game-icons.net
* - https://developers.trello.com/reference/
*/
Array.prototype.do = function(cb){
return this.map(function(){
function parseData(js, user){
var timeTaken = c => parseFloat((c.timeTaken ||(new Date().getTime()-Date.parse(c.data[0].date))) / 1000 / 60 / 60).toFixed(2);
var endDate = c => c.data[c.data.length-1].type == "addMemberToCard" ? "Working...": c.data[c.data.length-1].date;
return [[]].concat(js.filter(j => !j.member || j.member.id == user.id).sort((a,b) => Date.parse(a.date) - Date.parse(b.date)))
.reduce((a,b) => {
var k = b.data.card.name, card = a.find(c => c.name === k) || a[a.push(Object.assign({data:[]}, b.data.card))-1];
card.data.push(b);
if(b.type == "addMemberToCard")
card.lastJoin = b.date;
if(b.type == "removeMemberFromCard"){
function cartesian(arr) {
return arr.reduce((a, b) =>
a.map(x => b.map(y => x.concat(y)))
.reduce((a, b) => a.concat(b), []), [[]]);
}
function parse(f){
var re = /\[([0-9a-zA-Z,]+[^\]]+)\]/gm;
var m = null;
var res = [];
var lastIndex = 0;
@gbrian
gbrian / trellobranch.cmd
Created August 9, 2017 13:53
Create new mercurial branch associated to a trello card
@echo off
if "%1" == "" goto error
SET card=%1
For %%A in ("%card%") do (
Set Branch=%%~nxA
)
echo.Branch is: %Branch%
hg pull
@gbrian
gbrian / Sembo.SembAI.js
Last active January 27, 2018 06:20
Adding a new image comparer
(SembAI = {
loadAI: function() {
var d = jQuery.Deferred();
var oThis = this;
jQuery.getScript("https://sdk.clarifai.com/js/clarifai-latest.js", () => {
oThis.app = new Clarifai.App(
'xZqcIvLNv0f9wNzuVtA97ntA2CB8IHSVFzKc0hzv',
'KYkdTnFHmT6D4Yv8gk5gEPc__1fZ2nJItBrrI8hM');
console.log("Clarifai loaded");
d.resolve(window.SembAI);
function tagit(){
var app = new Clarifai.App(
'xZqcIvLNv0f9wNzuVtA97ntA2CB8IHSVFzKc0hzv',
'KYkdTnFHmT6D4Yv8gk5gEPc__1fZ2nJItBrrI8hM'
);
function tags(url, callback){
// predict the contents of an image by passing in a url
app.models.predict(Clarifai.TRAVEL_MODEL, url)
.then(
function(response) {
@gbrian
gbrian / d3-server.js
Created July 9, 2016 07:48 — forked from caged/d3-server.js
Directly render and serve d3 visualizations from a nodejs server.
// Start `node d3-server.js`
// Then visit http://localhost:1337/
//
var d3 = require('d3'),
http = require('http')
http.createServer(function (req, res) {
// Chrome automatically sends a requests for favicons
// Looks like https://code.google.com/p/chromium/issues/detail?id=39402 isn't
// fixed or this is a regression.