Skip to content

Instantly share code, notes, and snippets.

View PerfectlyNormal's full-sized avatar

PerfectlyNormal

View GitHub Profile

Privacy Policy

Last revised on [DATE]

The Gist

[COMPANY] will collect certain non-personally identify information about you as you use our sites. We may use this data to better understand our users. We can also publish this data, but the data will be about a large group of users, not individuals.

We will also ask you to provide personal information, but you'll always be able to opt out. If you give us personal information, we won't do anything evil with it.

Terms of Service

Last revised on [DATE]

The Gist

[COMPANY] operates the [SERVICE] service, which we hope you use. If you use it, please use it responsibly. If you don't, we'll have to terminate your account.

For paid accounts, you'll be charged on a monthly basis. You can cancel anytime, but there are no refunds.

before_filter :ensure_https
def ensure_https
if Rails.env == "production" && !request.ssl?
redirect_to "https://" + request.host + request.request_uri
flash.keep
return false
end
end
export RAILS_ENV=production
source /etc/profile
just sourced /etc/profile
Just sourced /usr/local/lib/rvm
just sourced profile
just sourced bashrc
just sourced /etc/profile
Just sourced /usr/local/lib/rvm
Just sourced /usr/local/lib/rvm
Just sourced /usr/local/lib/rvm
@PerfectlyNormal
PerfectlyNormal / application.html.erb
Created October 27, 2012 16:14
rails app on heroku
<!DOCTYPE html>
<html>
<head>
<title>M3</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<?php
header('Access-Control-Allow-Origin: *');
$src = 'https://www.goodreads.com/review/custom_widget/2268122.Reading?cover_position=middle&cover_size=medium&num_books=5&order=d&shelf=currently-reading&show_author=1&show_cover=1&show_rating=0&show_review=0&show_tags=0&show_title=1&sort=date_added&widget_bg_color=FFFFFF&widget_bg_transparent=&widget_border_width=1&widget_id=1494711042&widget_text_color=000000&widget_title_size=medium&widget_width=thin';
$contents = file_get_contents($src);
$start = strpos($contents, "var widget_code = ' ") + strlen("var widget_code = ' ");
$end = strpos($contents, "var widget_div") - $start - 4;
$html = substr($contents, $start, $end);
/*
* jQuery throttle / debounce - v1.1 - 3/7/2010
* http://benalman.com/projects/jquery-throttle-debounce-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this);