Skip to content

Instantly share code, notes, and snippets.

View bindzus's full-sized avatar

Thomas Bindzus bindzus

View GitHub Profile
**TODO: make gem for this**
This was tested using Rails 3.2 and Rails 4.0 on Ruby 2.0.0.
# Bower
1. Set the install directory for Bower components:
```js
// .bowerrc
@Stanback
Stanback / nginx.conf
Last active March 30, 2025 03:57 — forked from michiel/cors-nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
var printMap = function(map) {
map.setOptions({
mapTypeControl: false,
zoomControl: false,
streetViewControl: false,
panControl: false
});
var popUpAndPrint = function() {
dataUrl = [];
@jbenet
jbenet / simple-git-branching-model.md
Last active March 19, 2025 16:09
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@alejandro-isaza
alejandro-isaza / gist:5717438
Last active June 22, 2017 09:51
UIImage category to normalize image orientation by rotating an image so that it's orientation is UIImageOrientationUp. Based on http://stackoverflow.com/questions/5427656/ios-uiimagepickercontroller-result-image-orientation-after-upload/5427890#10611036
@interface UIImage (Orientation)
- (UIImage*)imageByNormalizingOrientation;
@end
@implementation UIImage (Orientation)
- (UIImage*)imageByNormalizingOrientation {
@iboard
iboard / ruby-destructor-example.rb
Last active March 21, 2025 09:32
Ruby 'Destructor' example.
class Foo
attr_reader :bar
def initialize
@bar = 123
ObjectSpace.define_finalizer( self, self.class.finalize(bar) )
end
def self.finalize(bar)
proc { puts "DESTROY OBJECT #{bar}" }
end
<!-- File: app/views/layouts/application.html.erb -->
<%= yield %>

Upgrade your JMVC to CanJS/JMVC 3.3

A informal guide to things that have changed over the past versions and how you can get your project up to snuff.

New

These aren't necessarily new features but things were there in some capacity before but expanded upon in latest.

  • Model.List is now available for Observes
  • You can call methods directly from templated bindings. F example: "resize":function() { this.updateUI() }); could now be just "resize": "updateUI"
  • instances() and instance() can be called on observes.
@alexsanford
alexsanford / application.html.erb
Created August 29, 2012 01:32
Render rails views inside a liquid block in Locomotive CMS
<!-- File: app/views/layouts/application.html.erb -->
<!DOCTYPE html>
<html>
<head>
<title>Locomotive Test</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
@trcarden
trcarden / gist:3295935
Created August 8, 2012 15:28
Rails 3.2.7 SSL Localhost (no red warnings, no apache config)
# 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