Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<!--[if IE 8]> <html lang="sv-SE" class="no-js ie8"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="sv-SE" class="no-js"> <!--<![endif]-->
<head>
<meta charset="UTF-8">
<title>Breakpoint detection test</title>
<style type="text/css" media="screen">
@media screen and (min-width: 320px) {
#page:after {
content: 'smallest'; /* represent the current width-bracket */
# Assuming you've setup Dragonfly to use your local filesystem, here's what you would
# do to get the images over to Amazon S3
# Specify the base path to where images reside on your system
DRAGONFLY_PATH = Rails.root.join("public", "system", "dragonfly", Rails.env)
# Next you'll need to loop over each model that is using dragonfly
SlideRiff.all.each do |riff|
slide_image_file = DRAGONFLY_PATH.join(riff.slide_image_uid)
# check if the file exists on the local filesystem, this allows you to
module ActionController
class Metal
attr_internal :cached_content_for
end
module Caching
module Actions
def _save_fragment(name, options)
return unless caching_allowed?
<?php
// Set these dependant on your BB credentials
$username = 'username';
$password = 'password';
// Grab the data from BB's POST service and decode
$json = stripslashes($_POST['payload']);
$data = json_decode($json);
namespace :deploy do
# Ask whether to reindex before restarting Passenger
task :restart, :roles => :app, :except => {:no_release => true} do
solr.reindex if 'y' == Capistrano::CLI.ui.ask("\n\n Should I reindex all models? (anything but y will cancel)")
run "touch #{File.join(current_path, 'tmp', 'restart.txt')}"
end
desc 'create shared data and pid dirs for Solr'
task :setup_solr_shared_dirs do
# conf dir is not shared as different versions need different configs
# Configure whenever
set :whenever_environment, rails_env
set :whenever_output, '/var/www/apps/alt12/current/log/crontab.log'
set :whenever_update_flags, "--update-crontab #{whenever_identifier} --set environment=#{whenever_environment}\\&output=#{whenever_output}" # notice the escaping \& passed to the shell
#!/bin/bash
#
# /etc/init.d/remote_syslog
#
# Starts the remote_syslog daemon
#
# chkconfig: 345 90 5
# description: Runs remote_syslog
#
# processname: remote_syslog
function color_meter(cwith, ccolor) {
if (!cwith && !ccolor) return;
var _cwith = (cwith.charAt(0)=="#") ? cwith.substring(1,7) : cwith;
var _ccolor = (ccolor.charAt(0)=="#") ? ccolor.substring(1,7) : ccolor;
var _r = parseInt(_cwith.substring(0,2), 16);
var _g = parseInt(_cwith.substring(2,4), 16);
var _b = parseInt(_cwith.substring(4,6), 16);
require 'gollum/frontend/app'
require 'digest/sha1'
class App < Precious::App
User = Struct.new(:name, :email, :password_hash, :can_write)
before { authenticate! }
before /^\/(edit|create|delete|livepreview|revert)/ do authorize_write! ; end
helpers do
@chrise86
chrise86 / gist:4683272
Last active December 12, 2015 00:19 — forked from aaronvb/gist:1087368
if Rails.env == "development"
Dir.foreach("#{Rails.root}/app/models") do |model_name|
require_dependency model_name unless model_name == "." || model_name == ".."
end
end
# or for nested models
if Rails.env == "development"
Dir.glob("#{Rails.root}/app/models/**/*.rb") do |model_name|