This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule S3Downloads do | |
@moduledoc """ | |
Use at your own risk. | |
Code heavily borrowed from: | |
- https://github.com/ex-aws/ex_aws/blob/main/lib/ex_aws/auth.ex | |
- https://gist.github.com/chrismccord/37862f1f8b1f5148644b75d20d1cb073 | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name site.production.designcompany.com; | |
root /home/forge/site.production.designcompany.com/public; | |
# enable gzip compression | |
gzip on; | |
gzip_min_length 1100; | |
gzip_buffers 4 32k; | |
gzip_types text/plain application/x-javascript image/svg+xml text/xml text/css; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Merging Scopes | |
# ============== | |
# The goal is to join two tables to get all the records where a scope on both | |
# side of the join is used. I used to do this with a `where()` in which I | |
# added some sql on the joined table. But, I wanted to use the existing scopes | |
# from the joining table. Turns out there's a `merge` method on a scope where | |
# you can merge with another scope without having to chain! | |
class Car < ActiveRecord::Base | |
has_and_belongs_to_many :people |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CommunitiesController < ApplicationController | |
# ... | |
def show | |
@community = Community.find(params[:id]) | |
@users = @community.users | |
@ressources = Ressource.paginate(:page => params[:page], :per_page => 5) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Credits to: | |
# - http://vstone.eu/reducing-vagrant-box-size/ | |
# - https://github.com/mitchellh/vagrant/issues/343 | |
aptitude -y purge ri | |
aptitude -y purge installation-report landscape-common wireless-tools wpasupplicant ubuntu-serverguide | |
aptitude -y purge python-dbus libnl1 python-smartpm python-twisted-core libiw30 | |
aptitude -y purge python-twisted-bin libdbus-glib-1-2 python-pexpect python-pycurl python-serial python-gobject python-pam python-openssl libffi5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- class_for_root_only = ((root_ol rescue true) ? 'sortable' : @first_call = '') | |
ol class=class_for_root_only data-sort-url=sort_website_pages_path(@website) | |
li id="list_#{page.id}" | |
.handle | |
= link_to page.name, edit_website_page_path(@website, page) | |
' | |
= active_icon(page, :published) | |
.btn-group.pull-right | |
= link_to t('View'), website_page_path(@website, page), :class => 'btn btn-mini' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/a/8936202 | |
# | |
# ActiveAdmin already includes the necessary jquery in active_admin/base, | |
# so just add this to javascripts/active_admin.js after //= require active_admin/base | |
# | |
# | |
# Serialize and Sort | |
# | |
# model_name - you guessed it, the name of the model we are calling sort on. | |
# This is the actual variable name, no need to change it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
# 1. Save this file as "make_webpages.command" | |
# 2. chmod a+x+r make_webpages.command | |
# 3. Place make_webpages.command in folder full of pictures | |
# 4. Double-click make_webpages.command | |
extensions = "png,PNG,jpg,JPG,gif" | |
working_dir = File.dirname($0) | |
pictures = Dir.glob("#{working_dir}/*.{#{extensions}}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Licence: MIT | |
# Created by tomykaira, 2011-10-25 | |
if [ $# -ne 1 ]; then | |
echo "Give me your new project name (only)" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $('img.photo',this).imagesLoaded(myFunction) | |
// execute a callback when all images have loaded. | |
// needed because .load() doesn't work on cached images | |
// Modified with a two-pass approach to changing image | |
// src. First, the proxy imagedata is set, which leads | |
// to the first callback being triggered, which resets | |
// imagedata to the original src, which fires the final, | |
// user defined callback. |
NewerOlder