Skip to content

Instantly share code, notes, and snippets.

This provides an .optim method for Dragonfly.

This requires you have the 'image_optim' gem in your Gemfile

module DefaultValues
def has_default_values(default_values = {})
cattr_accessor :default_values
self.default_values = default_values
after_initialize :assign_default_values
include InstanceMethods
// Adapted from the awesome zurb foundation
// https://github.com/zurb/foundation/blob/v5.2.0/scss/foundation/components/_block-grid.scss
//
// Block Grid Mixins
//
// We use this to control the maximum number of block grid elements per row
$block-grid-elements: 12 !default;

This runs provides an .optim job for dragonfly and also adds the .optim job into .thumb

This requires you have the 'image_optim' gem and it's dependencies.

/* @author 14islands.com
* SASS mixins for future proof resolution media query
*/
@mixin if-min-resolution($dppx) {
@include if-resolution(min, $dppx) {
@content;
}
}
<?php
// =================================================================
// getShares
// @author: Constantin Guay
// @url: https://gist.github.com/Cog-g/8284663
// v. 1.5.6
//
// This script will get number of shares for usual social networks.
//
// @param:
/usr/libexec/PlistBuddy -c 'Add :LSUIElement bool true' /Applications/iTerm.app/Contents/Info.plist
<?php
/**
* Get first paragraph from a WordPress post. Use inside the Loop.
*
* @return string
*/
function get_first_paragraph(){
global $post;
$str = wpautop( get_the_content() );
require 'resolv'
class EmailValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
if Resolv::DNS.new.getresources(value.split("@").last, Resolv::DNS::Resource::IN::MX).empty?
record.errors[attribute] << (options[:message] || "does not have a valid domain")
end
rescue Resolv::ResolvError, Resolv::ResolvTimeout
record.errors[attribute] << (options[:message] || "does not have a valid domain")
end
var scheduled = false,
_throttleDelay = 200;
function ScrollHandler(e) {
//throttle event:
if (!scheduled) {
scheduled = true;
setTimeout(function () {
console.log('scroll');