Skip to content

Instantly share code, notes, and snippets.

View snit-ram's full-sized avatar

Rafael Martins snit-ram

View GitHub Profile
function possibilities(numbers, remaining, expression) {
if (remaining < 0) {
return 0;
} else if (remaining === 0) {
console.log(expression.join(' + '));
return 1;
}
var result = 0;
@snit-ram
snit-ram / collectionview.swift
Created February 10, 2016 01:09
collectionview.swift
//
// ViewController.swift
// sss
//
// Created by Rafael Martins on 2/9/16.
// Copyright © 2016 Yahoo Inc. All rights reserved.
//
import UIKit
@snit-ram
snit-ram / bla.js
Last active September 29, 2016 13:59
var fetch = require('node-fetch');
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'me',
password : 'secret',
database : 'my_db'
});
connection.connect();
@snit-ram
snit-ram / hipchat-giphy
Last active September 13, 2018 18:02
hipchat-giphy "integration"
(function () {
function giphy(word, callback) {
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://api.giphy.com/v1/gifs/translate?api_key=dc6zaTOxFJmzC&s=' + encodeURIComponent(word));
xhr.onreadystatechange = function(e) {
if(xhr.readyState === 4) {
var url = JSON.parse(e.target.responseText).data.images.fixed_height.url;
callback(url);
}
};
@snit-ram
snit-ram / grunt.fish
Last active August 29, 2015 14:06
Fish grunt completion
# Completion for grunt
# Modified version by snit
# place this file at ~/.config/fish/completions/grunt.fish
# grunt-cli
# http://gruntjs.com/
#
# Copyright (c) 2012 Tyler Kellen, contributors
# Licensed under the MIT license.
# https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
@snit-ram
snit-ram / todo.fish
Created April 9, 2014 21:18
function for searching for common TODO patterns using ag
function todo
ag $argv "TODO|FIXME|NOTE|CHANGED|@todo"
end
@snit-ram
snit-ram / timeslice_disp_post.py
Created March 19, 2013 05:19
Arquivo usado pra exemplificar o uso do módulo timeslice aplicado ao problema de disponibilidade de links. Exemplo para o post de timeslice em meu blog
from timeslice import TimeSlice, TimeSet
from datetime import datetime
import calendar
def monta_grade():
grade = TimeSet()
dias_mes = calendar.monthrange(2013, 2)[1]
for dia in range(1, dias_mes + 1):
grade.append(
@snit-ram
snit-ram / timeslice-examples.py
Created March 19, 2013 04:34
Sample usage of timeslice module. Used in the timeslice post in my blog
from timeslice import *
from datetime import datetime, date
"""
TimeSlice Creation
"""
slice1 = TimeSlice(start=datetime(2009, 1, 1, 0, 0, 0),
end=datetime(2009, 1, 2, 0, 0, 0))
slice2 = TimeSlice(start=datetime(2009, 1, 1, 22, 33, 44),
@snit-ram
snit-ram / position-absolute.css
Created March 8, 2013 03:24
CSS for the position absolute article
html, body{
margin: 0;
padding: 0;
}
#dialog {
width: auto;
top: 50px;
left: 50px;
right: 50px;
@snit-ram
snit-ram / position-absolute.html
Created March 8, 2013 03:17
Html for the position absolute article
<div id="dialog">
<div id="navegacao"></div>
<div id="cabecalho"></div>
<div id="conteudo"></div>
<div id="rodape"></div>
</div>