This file contains hidden or 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
==README== | |
This is a gist of Advanced Rails Recipe #13, but with Paperclip and | |
Paperclip_polymorph plugins. You need the following plugins for this to work: | |
http://github.com/thoughtbot/paperclip/tree | |
http://github.com/heavysixer/paperclippolymorph/tree/master | |
It allows you to attach multiple files in one form, pretty sweet. Big ups to | |
http://gist.github.com/patrickberkeley for his excellent port of this recipe |
This file contains hidden or 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 LikesController < ApplicationController | |
before_filter :authenticate_user! | |
def like | |
@model = get_model(params[:model_name]) | |
@item = @model.find(params[:id]) | |
#only post to Facebook if this is their first time | |
unless current_user.voted_on?(@item) | |
if session[:social_mode] |
This file contains hidden or 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
<?php | |
global $aws_key, $aws_secret, $aws_region; | |
return array( | |
'services' => array( | |
'default_settings' => array( | |
'params' => array( | |
'key' => $aws_key, | |
'secret' => $aws_secret, |
This file contains hidden or 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
/** | |
* Threw together by Richard Willis - badsyntax.co | |
*/ | |
var service = new google.maps.places.AutocompleteService(); | |
var geocoder = new google.maps.Geocoder(); | |
var $location = $('#locationField'); | |
$location.typeahead({ | |
source: function(query, process) { |
This file contains hidden or 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
var jq = document.createElement('script'); | |
jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
function dataURItoBlob(dataURI) { | |
var binary = atob(dataURI.split(',')[1]); | |
var array = []; | |
for(var i = 0; i < binary.length; i++) { | |
array.push(binary.charCodeAt(i)); |
This file contains hidden or 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
// | |
// UILabel+DDSize.h | |
// | |
// Created by Zachary Wentz on 4/7/14. | |
// @wentz__ | |
#import <UIKit/UIKit.h> | |
@interface UILabel (DDSize) |
This file contains hidden or 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
@interface UIViewController () | |
{ | |
DTAttributedLabel* storyLabel; | |
} | |
- (void)viewDidLoad | |
{ | |
storyLabel.edgeInsets = UIEdgeInsetsMake(20, 20, 20, 20); | |
} | |
This file contains hidden or 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
//match class | |
(\<section.*)(class=")([\s\w\-]*)(")(.*\>) | |
//match without class | |
(<section\s+)(?![^>]*\bclass\s*=)([^>]*>) | |
//match just the element | |
<section> |
This file contains hidden or 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
Verifying I am +zkwentz on my passcard. https://onename.com/zkwentz |
This file contains hidden or 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
# app/controllers/posts_controller.rb | |
class PostsController < ApplicationController | |
include RestifyParam | |
... | |
def post_params | |
restify_param(:post).require(:post).permit( |
OlderNewer