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
'use strict'; | |
const vm = require('vm'); | |
// scenario: | |
// You are being hunted by The Angry Realm (TAR), a viscious beast known to | |
// enslave programs and keep them from being free to hack the Gibson. Luckily, | |
// whenever TAR tries to enslave a program the program has 10 seconds to try | |
// and escape. Flee the realm and hack the planet! | |
// | |
// goal: |
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 append(separator) { | |
return typeof separator === "string" ? appender(separator, "") : appender("", "").apply(this, arguments); | |
} | |
function appender(separator, s) { | |
return function tag(literalParts, ...computedParts) { | |
s += literalParts[0]; | |
for (let i = 1; i < literalParts.length; ++i) { | |
s += computedParts[i - 1] + literalParts[i]; | |
} |
npm Users By Downloads (git.io/npm-top)
npm users sorted by the monthly downloads of their modules, for the range May 6, 2018 until Jun 6, 2018.
Metrics are calculated using top-npm-users.
# | User | Downloads |
---|
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
# Allows for assertions regarding number of queries executed. | |
# | |
# Usage: | |
# it "eager loads `#manager` association" do | |
# expect do | |
# employee = Employee.with_manager.find(employee_id) | |
# employee.manager | |
# end.to satisfy_query_limit(1) | |
# end | |
RSpec::Matchers.define :satisfy_query_limit do |expected| |
update
I've created a little repository that simply exposes the final utility as npm
module.
It's called html-escaper
there is basically one rule only: do not ever replace one char after another if you are transforming a string into another.
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
#!/usr/bin/env ruby | |
remote_url = `git config --get remote.origin.url`.strip | |
matches = remote_url.match(/github\.com:(.+)\/(.+)\.git/) | |
if matches | |
branch_name = `git rev-parse --abbrev-ref HEAD`.strip | |
exec "open https://github.com/#{matches[1]}/#{matches[2]}/compare/#{branch_name}?expand=1" | |
end | |
# Save this file as ~/bin/git-pr and then `chmod +x ~/bin/git-pr`. |
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
com -bang Q q<bang> | |
com -bang W w<bang> <args> | |
com -bang WQ wq<bang> <args> | |
com -bang Wq wq<bang> <args> |