Skip to content

Instantly share code, notes, and snippets.

Ken Collins metaskills

Block or report user

Report or block metaskills

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@metaskills
metaskills / gist:3170386
Created Jul 24, 2012
Mapping A Sass List To A Comma Separated Selector
View gist:3170386
// Using this code below, I was able to itterate over a list of
// color names and append them to an empty list. I was then able
// to use the selectors from there.
$selectors: ();
@each $value in $my-colors-names {
$selector: unquote(".box.#{$value} .box-header");
$selectors: append($selectors, $selector, comma);
}
#{$selectors} { @extend .color-white; }
View Gemfile
gem 'jekyll', '~> 2.0.0.alpha'
gem 'nokogiri'
gem 'redcarpet'
gem 'rouge'
@metaskills
metaskills / passenger.rb
Created Sep 18, 2015
Rails Multi-Database Best Practices Roundup - config/initializers/passenger.rb - http://technology.customink.com/blog/2015/06/22/rails-multi-database-best-practices-roundup/
View passenger.rb
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
if forked
ActiveRecord::Base.clear_all_connections!
MysqlBase.establish_connection MysqlBase.configurations['mysql'][Rails.env]
end
end
end
@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;
@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')
You can’t perform that action at this time.