View pop-buffer-colors.js
['red','green'].forEach(function (color) {
document.querySelectorAll('.buffer-color-'+color).forEach(function (el) {
el.setAttribute('style','background-color:'+color+'!important;color:white!important;')
})
})
View create-buttons.js
document.querySelectorAll('*').forEach(function (element) {
if ( String(element.getAttribute('onclick')).startsWith('onAC') && String(element.innerHTML).length ) {
var title = element.innerHTML
var button = document.createElement('button')
button.innerHTML = element.innerHTML
button.addEventListener('click',function () {
jQuery(element)
.trigger('mouseover')
.trigger('contextmenu')
.trigger('mouseout');
View .env
process.env.FOO = 'FOO'
process.env.BAR = 'BAR'
View universal-definition-pattern.js
;(function() {
function myModule() {
}
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports = myModule;
}
else {
if (typeof define === 'function' && define.amd) {
define([], function() {
View create.js
[Model].create({[attributeKey]:[attributeValue]).exec(console.log)
View tmux-pairing
#create tmux session
tmux -S /tmp/tmux-pair new-session -s pairing
chmod 0777 /tmp/tmux-pair
#connect to tmux session
tmux -S /tmp/tmux-pair attach-session -t pairing
View foo-bar.js
(function (exports) {
function foo() {
return 'foo';
}
function bar() {
return 'bar';
}
exports.foo = foo;
exports.bar = bar;
}(typeof module !== 'undefined' ? module.exports : window))
View what.js
function Foo() {
}
var f = new Foo();
View object-to-form-data.js
function objectToFormData(obj) {
var pieces = [];
Object.keys(fd).forEach(function (key) {
pieces.push(`${key}=${fd[key]}`);
});
return pieces.join('&');
}
View better-errors-padrino.rb
# Gemfile
group :development do
gem "better_errors"
gem "binding_of_caller"
end
# config/boot.rb, after Bundler.require(:default, RACK_ENV)
if Padrino.env == :development
require 'better_errors'
Padrino::Application.use BetterErrors::Middleware