Skip to content

Instantly share code, notes, and snippets.

@johnkpaul
johnkpaul / getComputedStyleCssText.js
Created February 6, 2012 20:58
Approximate cssText on a CSSStyleDeclaration object in Firefox
function getComputedStyleCssText(element){
var cssObject = window.getComputedStyle(element),
prop,
cssText,
cssAccumulator = [];
if(cssObject.cssText != ""){
return cssObject.cssText;
}
@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
@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).

@johnkpaul
johnkpaul / gist:5125031
Created March 9, 2013 17:53
IRC can be touching
12:49 guesswho: oh shit
12:49 guesswho: it's there
12:49 guesswho: lol
12:49 guesswho: wow
12:50 johnkpaul: guesswho: it's working?
12:50 guesswho: yeah that's total insanity
12:50 johnkpaul: awesome, congratulations
12:50 pbor has left IRC (Ping timeout: 260 seconds)
12:50 guesswho: so simple but so long for me to do :(
12:50 tallest_red has left IRC (Ping timeout: 256 seconds)
@johnkpaul
johnkpaul / gist:4625005
Created January 24, 2013 16:53
something is up with www.qunitjs.com
➜ /tmp wget http://www.jquery.com
--2013-01-24 11:50:09-- http://www.jquery.com/
Resolving www.jquery.com... 70.32.120.34
Connecting to www.jquery.com|70.32.120.34|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://jquery.com/ [following]
--2013-01-24 11:50:09-- http://jquery.com/
Resolving jquery.com... 70.32.120.34
Reusing existing connection to www.jquery.com:80.
HTTP request sent, awaiting response... 200 OK
@johnkpaul
johnkpaul / app.js
Created August 4, 2012 18:45
IE9- and Backbone.history's pushState
//in your application, rather than using window.location to get the current url
App.getLocation = function(){
return window.location.protocol + '//' + window.location.host
+ '/' + Backbone.history.options.root + Backbone.history.getFragment()
}