Skip to content

Instantly share code, notes, and snippets.

View nbluis's full-sized avatar
:octocat:
I may be slow to respond.

Eduardo Bohrer nbluis

:octocat:
I may be slow to respond.
View GitHub Profile
@nbluis
nbluis / main.rb
Last active March 13, 2018 21:11
main.rb
def soma(p1, p2)
p1 + p2
end
def substrai(p1, p2)
p1 - p2
end
def multiplica(p1, p2)
p1 * p2
Array.prototype.slice.call(document.querySelectorAll('.book')).map(function(e) {
var details = e.childNodes[0].childNodes[1],
actions = e.childNodes[1],
title = details.childNodes[0].textContent.replace(/;/g,','),
author = details.childNodes[1].textContent.replace(/;/g,','),
situation = actions.hasChildNodes() ? 'DISPONIVEL' : 'LOCADO';
return [title, author, situation];
}).sort(function(a, b) {
return a[0].localeCompare(b[0]);
}).map(function(v) {
Array.from(document.querySelectorAll('.markdown-body li a'))
.map((el) => el.textContent.match(/.*\★(\d+)$/))
.filter((match) => match)
.filter((match) => parseInt(match[1]) > 500)
.sort((m1, m2) => parseInt(m2[1]) - parseInt(m1[1]))
.map((match) => match[0])
.forEach((entry) => console.log(entry));
(function() {
var container = $('.fc thead');
var cloneHead = $('<tr class="fc-first fc-last cloned-head"></tr>').css({
zIndex: 5,
display: 'none'
}).appendTo(container);
$('#schedule thead th').each(function() {
var cloned = $(this).clone();
cloned.css('width', $(this).outerWidth());
@nbluis
nbluis / service_script.sh
Created July 25, 2016 17:22
service_script.sh
#!/bin/sh
#
# description: ServiceName
# chkconfig: 2345 99 89
#
# Source function library.
. /etc/rc.d/init.d/functions
APP_NAME='ServiceName'
APP_DIR='/opt/service_dir'
@nbluis
nbluis / bounces.js
Last active January 28, 2016 11:27
Parse AWS bounces e-mails from gmail
(function() {
var messages = Array.prototype.slice.call(document.getElementsByClassName('adO'));
var emails = messages.map(function(m) {
return m.childNodes[0].getElementsByTagName('a')[1].getAttribute('href').replace('mailto:', '');
});
var hist = {};
emails.map( function (a) { if (a in hist) hist[a] ++; else hist[a] = 1; } );
console.log(hist);
})();
@nbluis
nbluis / install_pg_gem.sh
Created December 9, 2015 11:38
gem install pg on ubuntu
sudo apt-get install postgresql postgresql-client postgresql-contrib postgresql-server-dev-all
gem install pg
@nbluis
nbluis / tests.sh
Created December 8, 2014 15:19
static-server test failure
$ npm test
> static-server@1.1.0 test /home/ebohrer/projects/static-server
> mocha
StaticServer test
✓ should fail if rootPath is unspecified
✓ should expose the http STATUS_CODES object
@nbluis
nbluis / install.sh
Last active August 29, 2015 14:05
Installing Sublime Text 3 (3083) on Fedora 20 using shell script
#!/bin/sh
# Inspired by this gist https://gist.github.com/simonewebdesign/8507139 changing link from subl to sub and downloading the latest ST version.
# Sublime Text 3 (3065) install with Package Control
# Run this script with:
# $ curl <link> | sh
curl -o ~/st3.tar.bz2 http://c758482.r82.cf2.rackcdn.com/sublime_text_3_build_3083_x64.tar.bz2
if tar -xf ~/st3.tar.bz2 --directory=$HOME; then