Skip to content

Instantly share code, notes, and snippets.

View bronson's full-sized avatar

Scott Bronson bronson

  • Santa Cruz, CA
View GitHub Profile
@bronson
bronson / unstable-tailscale.nix
Last active October 2, 2022 01:47 — forked from epk/unstable-tailscale.nix
Installs unstable Tailscale
# Installs the latest version of Tailscale instead of the stable version.
# Run these two commands to prepare the unstable channel:
# nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs-unstable
# nix-channel --update nixpkgs-unstable
{ config, lib, pkgs, ... }:
let
baseconfig = { allowUnfree = true; };
unstable = import <nixpkgs-unstable> { config = baseconfig; };
@bronson
bronson / rake routes
Last active March 16, 2018 19:57
routes
Prefix Verb URI Pattern Controller#Action
project_items GET /projects/:project_id/items(.:format) items#index
POST /projects/:project_id/items(.:format) items#create
new_project_item GET /projects/:project_id/items/new(.:format) items#new
edit_project_item GET /projects/:project_id/items/:id/edit(.:format) items#edit
project_item GET /projects/:project_id/items/:id(.:format) items#show
PATCH /projects/:project_id/items/:id(.:format) items#update
PUT /projects/:project_id/items/:id(.:format) items#update
DELETE /projects/:project_id/items/:id(.:format) items#destroy
projects GET /projects(.:format) projects#index
const path = require('path')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const isProduction = (process.argv.indexOf('process.env.NODE_ENV=production') >= 0)
module.exports = {
// tell webpack where to loacate manifest-loader.js
resolveLoader: {
// A loader to transform a partial manifest.json file into a complete
// manifest.json file by adding entries from an NPM package.json.
// https://stackoverflow.com/questions/44232366/how-do-i-build-a-json-file-with-webpack
const fs = require('fs')
module.exports = function (source) {
this.addDependency('./package.json')
this.cacheable()
const pkg = JSON.parse(fs.readFileSync('./package.json'))
// currently:
entry: {
content: './src/content.js',
'hot-reload': './src/hot-reload.js',
manifest: './src/manifest.json',
popup: './src/popup.js'
},
output: {
path: path.resolve(__dirname, 'dist'),
@bronson
bronson / cpuprofile.txt
Created April 19, 2017 19:46
atom window reload
2713.3 ms 2713.3 ms (idle)
381.5 ms13.85 % 381.5 ms13.85 % (program)
248.6 ms9.02 % 475.1 ms17.24 % SourceMapConsumer_parseMappings<embedded>:103407
185.7 ms6.74 % 757.1 ms27.48 % get_Module._compile<embedded>:7340
154.4 ms5.60 % 154.4 ms5.60 % (garbage collector)
99.1 ms3.60 % 124.8 ms4.53 % compareByOriginalPositions<embedded>:177498
78.1 ms2.83 % 81.0 ms2.94 % attachedCallbackworkspace-element.js:13
69.9 ms2.54 % 71.0 ms2.58 % process.binding.internalModuleReadFileELECTRON_ASAR.js:585
69.6 ms2.53 % 69.6 ms2.53 % module.exports.AtomEnvironment.restoreWindowBackground<embedded>:994
57.6 ms2.09 % 67.9 ms2.46 % normalizeStringPosixpath.js:78
@bronson
bronson / 0 results
Last active March 24, 2017 02:06
benchmark splitting some strings in half (precompiling regexes)
$ rustc -L target/release/deps --test src/bench.rs && ./bench --bench
running 5 tests
test tests::bench_using_indexing ... bench: 1,674 ns/iter (+/- 69)
test tests::bench_using_regex_index ... bench: 249 ns/iter (+/- 20)
test tests::bench_using_regex_next ... bench: 134 ns/iter (+/- 7)
test tests::bench_using_regex_vec ... bench: 532 ns/iter (+/- 66)
test tests::bench_using_window ... bench: 964 ns/iter (+/- 39)
test result: ok. 0 passed; 0 failed; 0 ignored; 5 measured
Less::Error - expected ')' got '(':
less (2.6.0) lib/less/parser.rb:74:in `block (2 levels) in parse'
at finish (/Users/bronson/.gem/ruby/2.2.2/gems/less-2.6.0/lib/less/js/lib/less/parser.js:666:in `'
at tree.importVisitor.run (/Users/bronson/.gem/ruby/2.2.2/gems/less-2.6.0/lib/less/js/lib/less/import-visitor.js:34:in `'
at Parser.parser.parse (/Users/bronson/.gem/ruby/2.2.2/gems/less-2.6.0/lib/less/js/lib/less/parser.js:675:in `'
less (2.6.0) lib/less/parser.rb:64:in `block in parse'
less (2.6.0) lib/less/java_script/v8_context.rb:90:in `block in do_lock'
less (2.6.0) lib/less/java_script/v8_context.rb:88:in `call'
less (2.6.0) lib/less/java_script/v8_context.rb:88:in `Locker'
less (2.6.0) lib/less/java_script/v8_context.rb:88:in `do_lock'
@bronson
bronson / tester.rb
Last active March 18, 2016 23:05 — forked from anonymous/tester.rb
@b1 = button "Mjello?"
@para = para "please load some data"
@b1.click do
@para.replace File.read("tester.txt", "r"
end
/Users/bronson/.rubies/ruby-2.2.2/bin/ruby -w -Itest:lib:/Users/bronson/rails/railties/../activesupport/lib:/Users/bronson/rails/railties/../actionpack/lib:/Users/bronson/rails/railties/../activemodel/lib test/application/mailer_previews_test.rb
Run options: --seed 28851
# Running:
.................F...
Finished in 12.064605s, 1.7406 runs/s, 8.4545 assertions/s.
1) Failure: