Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary \
--allow-insecure-localhost \
--user-data-dir=/tmp/canary-session \
--disable-extensions \
"$*"
Verifying my Blockstack ID is secured with the address 1K3AQb5zongRJsGS4qRK18ZbrFDLU8bz4b https://explorer.blockstack.org/address/1K3AQb5zongRJsGS4qRK18ZbrFDLU8bz4b
@tomazy
tomazy / map-source.js
Last active November 24, 2017 18:16
extract bundle contents
const fs = require('fs');
const path = require('path');
const mkdirp = require('mkdirp');
const request = require('request-promise-native');
const { SourceMapConsumer } = require('source-map');
const usage = `
usage:
node map-source.js <bundle js url>
`
@tomazy
tomazy / docker-compose.yml
Last active May 22, 2017 15:02
Testing Rails app with Docker containers
# ./docker-compose.yml
version: "3"
services:
app:
build: .
env_file:
- .env
ports:
- 3000:3000 # app
- 35729:35729 # live reload
@tomazy
tomazy / snippet.js
Created April 25, 2017 06:09
automate adding codeship env vars from .env file or json
function codeShipSetVars(vars) {
const $blocks = getBlocks();
const keys = Object.keys(vars);
function getBlocks() {
return $('.form_block.environment_variable');
}
function add() {
getBlocks().last().find('button.-good').click();
@tomazy
tomazy / confirm-overwrite.js
Last active August 3, 2021 18:56
Overwrite `window.confirm` with a custom modal dialog (Rails + jquery-ujs + data-confirm attribute)
(function() { [9/55928]
'use strict';
function showConfirmBox(message, cb) {
var $modal = $('.js-modal-confirm');
var $btnYes = $modal.find('.js-yes')
var $btnCancel = $modal.find('.js-cancel')
$modal.find('.js-message').text(message)
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', '4.1.6'
gem 'rack'
gem 'pg', '0.17.1'
GEMFILE
system 'bundle'
end
@tomazy
tomazy / console-save.js
Last active August 29, 2015 14:09
console.save
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'
@tomazy
tomazy / disable-tests.sh
Last active August 29, 2015 14:08
Disable all javascript/coffe tests
find ./test -name "*-test.coffee"|xargs sed -i '' -e 's/ it / xit /g'
@tomazy
tomazy / knockout-chosen.js
Last active October 6, 2017 14:11
knockout + jquery chosen binding handler http://jsfiddle.net/tomazy/6A57J/
ko.bindingHandlers.chosen = {
init: function(element, valueAccessor, allBindings, viewModel, bindingContext){
var $element = $(element);
var options = ko.unwrap(valueAccessor());
if (typeof options === 'object')
$element.chosen(options);
else
$element.chosen();