Skip to content

Instantly share code, notes, and snippets.

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

Boris Barroso boriscy

🏠
Working from home
  • Lead With Purpose
  • Samaipata, Bolivia
View GitHub Profile
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
module Models::HstoreMap
def convert_hstore_to(to_type, *methods)
methods.each do |meth|
alias_method :"old_#{meth}", meth
define_method meth do
send(:"old_#{meth}").try(to_type)
end
end
end
parseDateDB = function(d) {
arr = d.split('-')
y = arr[0]
m = arr[1] * 1 - 1
d = arr[2]
try {
return new Date(y, m, d)
} catch (e)
return new Date()
}
@boriscy
boriscy / ssh_config
Created March 13, 2014 18:20
ssh configuration to make work on linuxmint 16 /etc/ssh/ssh_config
Host *
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes
GSSAPIDelegateCredentials no
Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
HostKeyAlgorithms ssh-rsa,ssh-dss
MACs hmac-md5,hmac-sha1,hmac-ripemd160
class Welss::Texas
BUILD = [:build_api, :build_county_name, :build_well_name]
def build
BUILD.each {|m| send(m) }
end
end

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

'use strict';
module.exports = function(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// configurable paths
var paths = {
@boriscy
boriscy / incomes_controller.rb
Last active October 14, 2017 08:05
Print to PDF using phantomjs
# Example controller
class IncomesController < ApplicationController
# Include the print
include Controllers::Print
# GET /incomes/1
def show
@income = present Income.find(params[:id])
respond_to do |format|
blue = '#16A9E3'
green = '#7FC06B'
width = 300
height = 150
space = 40
x = d3.scale.ordinal()
.rangeRoundBands([0, width], 10)