Skip to content

Instantly share code, notes, and snippets.

Ken Collins metaskills

View GitHub Profile
@metaskills
metaskills / demo.rb
Last active Nov 28, 2018
Using IMGIX to Personalize Knolled Images
View demo.rb
require 'open-uri'
require 'bundler/inline'
gemfile true do
source 'https://rubygems.org'
gem 'imgix'
gem 'launchy'
end
DESIGN_URL = 'https://www.customink.com/email/imgix/design.png'
@metaskills
metaskills / reconstructor.coffee
Created Jan 10, 2018
Turbolinks & jQuery ReConstructor Pattern
View reconstructor.coffee
class Toolbar
constructor: ->
document.addEventListener 'turbolinks:before-cache', @turboBeforeCache
@reConstructor()
reConstructor: ->
@registerWaypoint()
registerWaypoint: ->
@metaskills
metaskills / turbolinks_enquire.coffee
Created Jan 10, 2018
Turbolinks With Enquire JS
View turbolinks_enquire.coffee
@metaskills
metaskills / turbolinks_trustpilot.coffee
Created Jan 10, 2018
Turbolinks Trustpilot Integration
View turbolinks_trustpilot.coffee
@metaskills
metaskills / ready.js
Created Jan 10, 2018
When Are Things Ready?
View ready.js
document.addEventListener('DOMContentLoaded', function(){
console.log('DOMContentLoaded');
});
document.addEventListener('turbolinks:load', function(){
console.log('turbolinks:load');
});
jQuery(function(){
console.log('jQuery Document Ready');
@metaskills
metaskills / foo.rb
Created Jan 10, 2018
Basic HTML Page
View foo.rb
<!DOCTYPE html>
<html>
<head>
<title>My Page</title>
<script src="..."></script>
</head>
<body>
<h1>Hello World!</h1>
<script src="..."></script>
</body>
@metaskills
metaskills / sam-validate.rb
Created Dec 28, 2017
Parse AWS SAM YAML Templates & Validate JSON Schema
View sam-validate.rb
#!/usr/bin/env ruby
require 'pp'
require 'json'
require 'yaml'
require 'open-uri'
require 'json-schema'
SCHEMA = begin
file = open('https://raw.githubusercontent.com/awslabs/goformation/master/schema/sam.schema.json')
@metaskills
metaskills / gitio.sh
Last active Aug 29, 2017
Shell Function for Git.io
View gitio.sh
gitio () {
local url=$(curl -s -i https://git.io -F "url=$1" | grep "Location: " | cut -d" " -f2)
echo -n $url | tr -d '\n' | pbcopy
echo $url
}
@metaskills
metaskills / bm.rb
Created Aug 1, 2017
Simple SQL Server & PG Rails Benchmarks.
View bm.rb
#!/usr/bin/env ruby
require 'benchmark'
require 'bundler/inline'
gemfile true do
source 'https://rubygems.org'
gem 'activerecord-sqlserver-adapter', ENV['VER_AR'] || '~> 5.1.0'
gem 'tiny_tds', ENV['VER_TTDS'] || '~> 2.0.0'
gem 'pg'
@metaskills
metaskills / lp.js
Last active Jan 17, 2018
LivePerson/Engage Turbolinks Hacking
View lp.js
// Assuming you put the LP init code into a function called window.lpTagCustomInit
document.addEventListener('turbolinks:before-cache', function(){
jQuery("[id^='LP_DIV']").empty();
})
document.addEventListener('turbolinks:load', function(){
delete window.liveperson;
delete window.lpMTagConfig;
delete window.lpTag;
You can’t perform that action at this time.