Skip to content

Instantly share code, notes, and snippets.

View gabemartinez's full-sized avatar

Gabriel Martinez gabemartinez

View GitHub Profile
@cpjobling
cpjobling / .gitignore-rails
Created April 1, 2011 15:08
A .gitignore for Rails development on Mac OSX (via Ruby on Rails Tutorial)
.bundle
db/*.sqlite3
log/*.log
*.log
tmp/**/*
tmp/*
doc/api
doc/app
*.swp
*~
@dhg
dhg / Skeleton Grid
Created May 6, 2011 19:40
This is the Skeleton.gs grid example
<!-- The container is a centered 960px -->
<div class="container">
<!-- Give column value in word form (one, two..., twelve) -->
<div class="sixteen columns">
<h1>Full Width Column</h1>
</div>
<!-- Sweet nested columns cleared with a clearfix class -->
<div class="six columns clearfix">
@mbostock
mbostock / .block
Last active April 8, 2024 13:46
Hello, D3!
license: gpl-3.0
@victorbstan
victorbstan / paperclip_image_dimensions_validation.rb
Created November 23, 2011 01:21
Paperclip Validate minimum image dimensions
validate :check_dimensions
def check_dimensions
temp_file = background_image.queued_for_write[:original]
unless temp_file.nil?
dimensions = Paperclip::Geometry.from_file(temp_file)
width = dimensions.width
height = dimensions.height
if width < 800 && height < 600
@n1k0
n1k0 / gist:1501173
Created December 20, 2011 10:44 — forked from fbuchinger/gist:1501115
PhantomJS: Capturing single dom elements as png files
var page = new WebPage(),
address, output, size;
//capture and captureSelector functions adapted from CasperJS - https://github.com/n1k0/casperjs
capture = function(targetFile, clipRect) {
var previousClipRect;
var clipRect = {top: 0, left:0, width: 40, height: 40};
if (clipRect) {
if (!isType(clipRect, "object")) {
throw new Error("clipRect must be an Object instance.");
@trey
trey / gist:1739889
Created February 4, 2012 20:22
Get Bootstrap's fancy Glyphicons working in Rails

Well, to get Bootstrap working, first install [Less Rails Bootstrap][lrb].

Then create a button with a [fancy icon][fi] like so:

<%= link_to raw('<i class="icon-trash icon-white"></i>'), card, confirm: 'Are you sure?', method: :delete, :class => 'btn btn-danger' %>

Note that you have to link to raw to get it to not escape the HTML.

@jxson
jxson / README.md
Created February 10, 2012 00:18
README.md template

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation

@davatron5000
davatron5000 / gist:2254924
Created March 30, 2012 20:57
Static Site Generators

Backstory: I decided to crowdsource static site generator recommendations, so the following are actual real world suggested-to-me results. I then took those and sorted them by language/server and, just for a decent relative metric, their Github Watcher count. If you want a heap of other projects (including other languages like Haskell and Python) Nanoc has the mother of all site generator lists. If you recommend another one, by all means add a comment.

Ruby

@zxcvbnm4709
zxcvbnm4709 / gist:2656197
Created May 10, 2012 22:06
include jQuery in Chrome Console
var script = document.createElement("script");
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
@url2png
url2png / url2png-v6.php
Last active October 4, 2015 16:18
v6 Examples
<?php
function url2png_v6($url, $args) {
# Get your apikey from http://url2png.com/plans
$URL2PNG_APIKEY = "PXXXX";
$URL2PNG_SECRET = "SXXXX";
# urlencode request target
$options['url'] = urlencode($url);