Skip to content

Instantly share code, notes, and snippets.

Avatar

Scott Bronson bronson

View GitHub Profile
View rake 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
View webpack.config.js
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: {
View manifest-loader.js
// 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'))
View webpack.config.js
// 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 Apr 19, 2017
atom window reload
View cpuprofile.txt
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 Mar 24, 2017
benchmark splitting some strings in half (precompiling regexes)
View 0 results
$ 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
View log.txt
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'
View tester.rb
@b1 = button "Mjello?"
@para = para "please load some data"
@b1.click do
@para.replace File.read("tester.txt", "r"
end
View 1. railties `rake test` fail
/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:
View gist:e9257b65671314737448
MariaDB [(none)]> set old_mode=ZERO_DATE_TIME_CAST;
Query OK, 0 rows affected (0.00 sec)
MariaDB [test]> select @@old_mode, @@global.old_mode;
+---------------------+-------------------+
| @@old_mode | @@global.old_mode |
+---------------------+-------------------+
| ZERO_DATE_TIME_CAST | |
+---------------------+-------------------+
1 row in set (0.00 sec)
You can’t perform that action at this time.