Skip to content

Instantly share code, notes, and snippets.

View mrjman's full-sized avatar

Jesse mrjman

  • Mondo Robot
  • Boulder
View GitHub Profile
@mrjman
mrjman / dg_helper.module
Last active August 29, 2015 13:57
Localization changes
function dg_helper_gallery_api_collections() {
...
// Old code
//
// The problem is the use of LANGUAGE_NONE
//
$albums[] = array(
'slug' => $slug,
@mrjman
mrjman / node--partner--teaser.tpl.php
Last active August 29, 2015 14:00
node--partner--teaser.tpl.php
<?php
/**
*
*/
?>
<?php
/*****************************************
* THIS CODE IS NEW
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@mrjman
mrjman / gtm_events.js
Last active August 29, 2015 14:02
gtm dataLayer example
jQuery(function($) {
$('.home-page-banner-register').on('click', function(e) {
dataLayer.push({
'category': 'FI_Register',
'action': 'Begin Registration',
'label': 'Hero Button Click'
});
});
$('.home-page-footer-icon-register').on('click', function(e) {
@mrjman
mrjman / font.scss
Last active August 29, 2015 14:03
Generic font handling in SASS
//
// mixin for bullet proof font declaration syntax
// pulled from: http://pivotallabs.com/bulletproof-font-face-syntax-with-sass/
//
// font-path is a rails helper which can be replaced with your font directory path
// when not using rails
//
@mixin declare-font-face($font-family, $font-filename, $font-weight: normal, $font-style: normal, $font-stretch: normal) {
@font-face {
font-family: '#{$font-family}';
@mrjman
mrjman / reset_sequences.rake
Created July 2, 2014 15:53
Reset PK sequences in Rails
ActiveRecord::Base.connection.tables.each do |table|
ActiveRecord::Base.connection.reset_pk_sequence!(table)
end
@mrjman
mrjman / test.rb
Last active August 29, 2015 14:04
require "net/http"
require "openssl"
cert_store = OpenSSL::X509::Store.new
cert_store.add_file 'certs/AddTrustExternalCARoot.crt'
cert_store.add_file 'certs/COMODORSAAddTrustCA.crt'
http = Net::HTTP.new('ume.michaeljfox.org', 8097)
#http = Net::HTTP.new('173.193.29.12', 11121)
@mrjman
mrjman / gist:7afaf0e20d8768782c82
Last active August 29, 2015 14:05 — forked from kalmbach/gist:4471560
Rake migration tasks for Sequel
namespace :db do
require "sequel"
Sequel.extension :migration
DB = Sequel.connect(ENV['DATABASE_URL'])
desc "Prints current schema version"
task :version do
version = if DB.tables.include?(:schema_info)
DB[:schema_info].first[:version]
end || 0
@mrjman
mrjman / gist:5abea699d143c26c0520
Last active August 29, 2015 14:05
Export database from heroku and import locally
curl -o `date +"%Y%m%d%H%M%S"_BACKUPFILENAME.dump `heroku pgbackups:url --app APPNAME`
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U PGUSERNAME -d LOCALDBNAME BACKUPFILENAME.dump
module Builder
def collection_otherable_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {}, &block)
SimpleForm::Tags::CollectionCheckBoxes.new(@object_name, method, @template, collection, value_method, text_method, objectify_options(options), @default_options.merge(html_options)).render(&block)
end
def collection_nested_versionable(method, collection, value_method, text_method, options = {}, html_options = {}, &block)
SimpleForm::Tags::CollectionCheckBoxes.new(@object_name, method, @template, collection, value_method, text_method, objectify_options(options), @default_options.merge(html_options)).render(&block)
end
end