Skip to content

Instantly share code, notes, and snippets.

@johnkpaul
johnkpaul / keybase.md
Created February 6, 2018 18:58
keybase.md

Keybase proof

I hereby claim:

  • I am johnkpaul on github.
  • I am johnkpaul (https://keybase.io/johnkpaul) on keybase.
  • I have a public key ASCQXaLzmpRi68-yrWO6Xj4-PdEOmQzXrG1sIlB75AIn4Ao

To claim this, I am signing this object:

@johnkpaul
johnkpaul / test.rb
Last active August 24, 2016 20:39
1) Run `ruby test.rb` 2) Why are global methods in the private method list of lambdas?
def test_method
puts 'test'
end
l = -> { puts 'lambda' }
# Why does this print true??
puts l.private_methods.include? :test_method
function add() {
var args = [].slice.call(arguments);
var sum = args.reduce(function(a, b){ return a + b; }, 0);
return numify(sum);
function numify(num){
var ret = function(a){
return a === undefined ? numify(num) : numify(a + num);
}
class SumOfFactors
def initialize(until_num, *divisible_by)
@until_num = until_num
@divisible_by = divisible_by
end
def get_sum
get_range.select(&self.method(:is_disivible_by))
.inject(&self.method(:sum_arr))
on run {}
activate application "Microsoft Outlook"
tell application "Microsoft Outlook"
set selected folder to folder "Archive"
end tell
tell application "System Events"
keystroke "f" using {option down, command down}
end tell
end run
@johnkpaul
johnkpaul / 0.0.58.js
Created September 1, 2014 20:42
Traceur compile in the browser
var compiler = new traceur.Compiler;
compiler.script(content, {experimental: true})
.then(function(result){
var source = result.js;
eval(source);
});
@johnkpaul
johnkpaul / component-list.md
Last active December 24, 2015 12:19
Ember.Component list
@johnkpaul
johnkpaul / gist:5987772
Created July 12, 2013 20:54
vimscript to run jsbeautifier and refresh all buffers
fun! BeautifyAndRefresh()
set noconfirm
!grunt jsbeautifier
bufdo e!
set confirm
endfun
nmap <leader>b call BeautifyAndRefresh()
@johnkpaul
johnkpaul / editor.js
Created June 4, 2013 12:51
Who needs text editors? I write JavaScript
node -e 'process.stdin.pipe(require("fs").createWriteStream(process.argv[1]))' FILENAME
@johnkpaul
johnkpaul / module_loader_question.md
Last active December 15, 2015 07:59
A Module Loader Question

A Module Loader Question

I want to know if I can achieve one particular goal with any particular module loader. Let me tell you a story.

My Fantasy App

I work on a large client side JavaScript application for a company with a fremium business model. Let's call it Freely. Freely's free experience is composed of modules A, B and C in the application. Once the user hands over their credit card, they enter the paid experience, which is composed of modules B-Z.

Each of modules A-Z is roughly the same size, so the free experience requires roughly 1/9th of the entire codebase in order to function correctly. I don't want the client to need to download all of the modules becuase only 1/100th of all users will actually end up paying. (The conversion rate is another issue, but at Freely, we're more focused on other things).