Skip to content

Instantly share code, notes, and snippets.

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

Evaldo Santos evaldosantos

🏠
Working from home
View GitHub Profile
class Integer
N_BYTES = [42].pack('i').size
N_BITS = N_BYTES * 16
MAX = 2 ** (N_BITS - 2) - 1
MIN = -MAX - 1
end
p Integer::MAX #=> 4611686018427387903
p Integer::MAX.class #=> Fixnum
p (Integer::MAX + 1).class #=> Bignum
# fetch all branchs from remote
for b in `git branch -r | grep -v -- '->'`; do git branch --track ${b##origin/} $b; done
<div class="spinner">
<input class="spinner-input" type="text" />
<a class="spinner-button spinner-up" href="#">+</a>
<a class="spinner-button spinner-down" href="#">-</a>
</div>
.spinner {display:inline-block; position:relative; border:1px solid #dcdcdc; border-radius:4px; overflow:hidden;}
.spinner-input {width:46px; margin-right:23px; border:none; padding:0 3px; height:23px; line-height:23px; border-right:1px solid #dcdcdc;}
.spinner-button {text-decoration:none; position:absolute; right:0; background: #efefef; height:11px; line-height:11px; width:23px;}
.spinner-up, .spinner-down{text-align: center;}
var add = function(x, y) { return x + y };
var multiply = function(x, y) { return x * y };
// associative
add(add(x, y), z) == add(x, add(y, z));
// commutative
add(x, y) == add(y, x);
// identity
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<button class="button_">button 1</button>
<button>button 2</button>
<button class="button_">button 3</button>
<script type="text/javascript">
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<button id="decrement">-</button>
<input type="text" />
<button id="increment">+</button>
<script type="text/javascript">
//console.log('HELLO WORLD')
//console.log(process.argv.slice(2).reduce(function(sum, el) { return sum+parseInt(el, 10);}, 0))
//var fs = require('fs');
//var file = fs.readFileSync(process.argv[2]);
//console.log(file.toString().split('\n').length-1);
//var fs = require('fs');
//fs.readFile(process.argv[2], function(err, data) {
// if(!err) {
// console.log(data.toString().split('\n').length-1);
// }
<?xml version="1.0" encoding="UTF-8"?>
<!-- Do not edit this file, it will be overwritten on install.
Copy the file to $HOME/.config/openbox/ instead. -->
<openbox_config xmlns="http://openbox.org/3.4/rc" xmlns:xi="http://www.w3.org/2001/XInclude">
<resistance>
<strength>10</strength>
<screen_edge_strength>20</screen_edge_strength>
</resistance>
<focus>
<focusNew>yes</focusNew>
@evaldosantos
evaldosantos / gist:49b8ffff57a0efb997ed
Created January 12, 2016 20:14
Paypal billing agreement
var express = require('express'),
request = require('request'),
url = require('urlcode-json');
var app = express();
app.get('/gettoken', function (req, res) {
request.post({url:'https://api-3t.sandbox.paypal.com/nvp', form: {
USER: process.env.USER,
PWD: process.env.PWD,
function Stack(tArr) {
var arr = tArr || [];
this.push = function(n) {
arr.push(n);
return this;
};
this.pop = function() {
arr.pop();
return this;