This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fetch all branchs from remote | |
for b in `git branch -r | grep -v -- '->'`; do git branch --track ${b##origin/} $b; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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;} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
<button id="decrement">-</button> | |
<input type="text" /> | |
<button id="increment">+</button> | |
<script type="text/javascript"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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); | |
// } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Stack(tArr) { | |
var arr = tArr || []; | |
this.push = function(n) { | |
arr.push(n); | |
return this; | |
}; | |
this.pop = function() { | |
arr.pop(); | |
return this; |