View app.rb
This file contains 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
puts 'Hello, World!' |
View module-lookup-paths.js
This file contains 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
const Module = require('module') | |
Module._resolveLookupPaths = new Proxy(Module._resolveLookupPaths, { | |
apply(target, self, args) { | |
console.dir(args[1].paths) | |
return target.apply(self, args) | |
} | |
}) | |
require('name-of-module') |
View graceful-vfs-src-with-gs-and-pipeline.js
This file contains 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
const fs = require('fs') | |
const gs = require('glob-stream') | |
const File = require('vinyl') | |
const { Transform } = require('stream') | |
const map = (transform) => new Transform({ objectMode: true, transform }) | |
const ospath = require('path') | |
//const isUTF8 = require('is-utf8') | |
const { pipeline } = require('stream') | |
function smartStat (path_, callback) { |
View jruby-thread-safety-test.rb
This file contains 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
require 'asciidoctor-pdf' | |
require 'java' | |
java_import 'java.util.concurrent.Callable' | |
java_import 'java.util.concurrent.FutureTask' | |
java_import 'java.util.concurrent.LinkedBlockingQueue' | |
java_import 'java.util.concurrent.ThreadPoolExecutor' | |
java_import 'java.util.concurrent.TimeUnit' | |
class App | |
include Callable |
View file.rb
This file contains 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 File | |
class << self | |
def absolute_path? path | |
(path.start_with? '/') || (ALT_SEPARATOR && (path.start_with? (absolute_path path).slice 0, 3)) | |
end unless method_defined? :absolute_path? | |
end | |
end |
View cut-release.sh
This file contains 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/bash | |
# GEM_VERSION=1.5.0.alpha.10 NEXT_GEM_VERSION=1.5.0.alpha.11.dev ./cut-release.sh -p | |
PUSH=false | |
while getopts "p" option; do | |
case $option in | |
p) PUSH=true ;; | |
esac | |
done |
View syntax-highlighter-rouge.rb
This file contains 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 RougeSyntaxHighlighter < Asciidoctor::SyntaxHighlighter::Base | |
register_for 'rouge' | |
def initialize *args | |
super | |
@requires_stylesheet = nil | |
@style = nil | |
end | |
def highlight? |
View syntax-highlighter-prism.rb
This file contains 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 PrismSyntaxHighlighter < Asciidoctor::SyntaxHighlighter::Base | |
register_for 'prism' | |
def format node, lang, opts | |
opts[:transform] = proc do |pre, code| | |
if node.attr? 'linenums', nil, false | |
pre['class'] += ' line-numbers' | |
if (start = node.attr 'start', nil, false) | |
pre['data-start'] = start | |
end |
View server-in-thread-multiple-clients.rb
This file contains 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
# serve multiple clients at once | |
require 'socket' | |
require 'net/http' | |
server = TCPServer.new 4040 | |
server_thread = Thread.start do | |
loop do | |
Thread.start server.accept do |socket| | |
/^GET (\S+) HTTP\/1\.1$/ =~ socket.gets.chomp | |
path = $1 |
NewerOlder