Skip to content

Instantly share code, notes, and snippets.

View pjambet's full-sized avatar

Pierre Jambet pjambet

View GitHub Profile
var getAllObjects = function(className, options) {
var batchSize = 100;
var grandResult = [];
var offset = 0;
var getNextBatch = function(objects) {
if (objects) {
grandResult = grandResult.concat(objects);
}
if (objects === null || objects.length === batchSize) {
var query = new Parse.Query(className);
Wed Sep 17 15:09:16 2014 Natalie Weizenbaum <nweiz@google.com>
* ext/pathname/lib/pathname.rb (SAME_PATHS):
Pathname#relative_path_from uses String#casecmp to compare strings
on case-insensitive filesystem platforms (e.g., Windows). This can
return nil for strings with different encodings, and the code
previously assumed that it always returned a Fixnum. [Fix GH-713]
Wed Sep 17 15:07:35 2014 Sho Hashimoto <sho.hsmt@gmail.com>
@pjambet
pjambet / keybase.md
Created February 23, 2015 17:13
keybase.md

Keybase proof

I hereby claim:

  • I am pjambet on github.
  • I am pierrej (https://keybase.io/pierrej) on keybase.
  • I have a public key whose fingerprint is D971 2AA5 0673 BD0A 5BA9 EB09 ABCE CFD5 45D1 7EA0

To claim this, I am signing this object:

"💩".gsub(/([\u{2600}-\u{26FF}]|[\u{1F000}-\u{1F8FF}]|[\u{2300}-\u{23FF}])/, "")
ref:
http://stackoverflow.com/questions/24672834/how-do-i-remove-emoji-from-string/24673322#24673322
http://en.wikipedia.org/wiki/Unicode_block
# option A
list = [1,2,3,4]
list2 = [
1,
2,
3,
4,
]
@pjambet
pjambet / gist:3702678
Created September 11, 2012 22:38
Why I don't like method missing
require 'benchmark'
class A
def m
@foo = 1
end
end
class B
def method_missing(meth, *args, &block)
@pjambet
pjambet / sass_mixins.sass
Created September 16, 2012 18:00
My mixins
@mixin arrow_bottom_001($color: black, $width: 4px)
position: relative
&:after
content: ""
height: 0
width: 0
border-style: solid
border-width: $width
border-color: $color transparent transparent transparent
position: absolute
@pjambet
pjambet / fibo.js
Created September 19, 2012 20:53
Fibonacci with & without memoizer
var limit = 100000000
var fibonacci = function(n) {
if (typeof fibonacci.count === 'undefined') {
fibonacci.count = 0
}
fibonacci.count += 1
return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2)
}
var start = new Date().getTime()
var garbageInput = form.children().last();
if(garbageInput.attr('id') == "javax.faces.ViewState") {
form[0].removeChild(garbageInput[0]);
}