Skip to content

Instantly share code, notes, and snippets.

View postpostmodern's full-sized avatar

Jason T Johnson postpostmodern

View GitHub Profile
@postpostmodern
postpostmodern / _colors.scss
Created June 15, 2016 21:52
Color Guide: Visualize all of the colors for your site.
$colors: (
white: white,
gray1: rgb(238, 240, 242),
gray2: rgb(187, 196, 201),
gray3: rgb(162, 168, 172),
gray4: rgb(110, 116, 120),
accent: red
);
@function c($key) {
@postpostmodern
postpostmodern / 0_reuse_code.js
Created December 16, 2013 20:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@postpostmodern
postpostmodern / track_event.js
Created May 16, 2013 20:05
General event tracking for Google Universal Analytics
$('body').on('click', 'a, img, button', function(e) {
var $el = $(e.target);
if($el.data('event-count')) {
$el.data('event-count', ($el.data('event-count') + 1));
} else {
$el.data('event-count', 1);
}
var category = e.target.nodeName;
#!/usr/bin/env ruby
require 'fog'
require 'open-uri'
class BrandsmithDNS
def initialize
@dns = Fog::DNS.new(:provider => 'rackspace', :rackspace_api_key => 'xxxxxxxxxxxxxxxxxx', :rackspace_username => 'yyyyyyyyyyyyyyyyyy')
@record = @dns.zones.get('11111111').records.get('A-222222222')
end
@postpostmodern
postpostmodern / plan.js
Created September 21, 2012 14:22 — forked from wyattdanger/plan.js
js demo
var Plan = (function() {
// protected
var records = [];
// the Plan constructor
function Plan(key, id, price) {
this.id = id;
this.price = price;
var more = key.split('||');
@postpostmodern
postpostmodern / sanitize_for_dom_id.coffee
Created August 20, 2012 21:40
Cleans up a string for suitability as a css id or class
sanitizeForDomID = (str) ->
chars =
"ä": "ae"
"ö": "oe"
"ß": "ss"
"ü": "ue"
"æ": "ae"
"ø": "oe"
"å": "aa"
"é": "e"
@postpostmodern
postpostmodern / PIE.htc
Created July 4, 2012 19:37
Sass Mixins for CSS3 with CSS3PIE support
<!--
PIE: CSS3 rendering for IE
Version 1.0.0
http://css3pie.com
Dual-licensed for use under the Apache License Version 2.0 or the General Public License (GPL) Version 2.
-->
<PUBLIC:COMPONENT lightWeight="true">
<!-- saved from url=(0014)about:internet -->
<PUBLIC:ATTACH EVENT="oncontentready" FOR="element" ONEVENT="init()" />
<PUBLIC:ATTACH EVENT="ondocumentready" FOR="element" ONEVENT="init()" />
function longestCommonPrefix(arr) {
var prefix = '';
var firstWord = arr[0];
function inAll(letter, idx) {
for(var j=0; j<arr.length; j++) {
if(arr[j][idx] != letter) return false;
}
return true;
}
@postpostmodern
postpostmodern / seeds.rb
Created March 20, 2012 14:38
Example seeds.rb file which creates records and imports records from CSV files
Language.create!(name: 'English (US)', code: 'en', locale: 'en-US') if Language.count == 0
if Administrator.count == 0
admin = Administrator.new(
first_name: 'Super',
last_name: 'Admin',
email: 'admin@example.com',
password: 'adminpass',
password_confirmation: 'adminpass'
)
@postpostmodern
postpostmodern / rails_bootstrap_delete_confirmation_modal.md
Created February 19, 2012 07:38 — forked from trey/rails_bootstrap_delete_confirmation_modal.md
A nice delete confirmation modal in Rails courtesy of Bootstrap

Here's what you get.

Some CoffeeScript (verbosely commented for clarity)

# Override Rails handling of confirmation

$.rails.allowAction = (element) ->
  # The message is something like "Are you sure?"
  message = element.data('confirm')