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
View flickr-hacky-download.js
var photos = document.getElementsByClassName('photo-list-photo-view');
var photos_length = photos.length;
for ( var i = 0; i < photos_length; i++ ) {
var photo = photos[i];
var style_bg_image = photo.style.backgroundImage;
var url = 'https:' + style_bg_image.replace('url(','').replace(')','');
url = url.replace('"', '');
url = url.replace('"', '');
View jquery.js
(function(){
var init = function () {
};
$(document).ready(function () {
init();
});
$(window).on('load', function () {
});