Skip to content

Instantly share code, notes, and snippets.

Hartwig Brandl hbrandl

Block or report user

Report or block hbrandl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
hbrandl / application.yml
Created Aug 5, 2014
application.yml to be used with hbrandl/rails_with_login
View application.yml
# encoding: UTF-8
# this file lives at /config/application.yml
# Add application configuration variables here, as shown below.
#### Facebook ####
hbrandl / YouTube-API-V2-BrowserUpload-workaround.js
Last active Dec 27, 2015
JS that fixes the YouTube-API V2 Browser Upload for Firefox < 26
View YouTube-API-V2-BrowserUpload-workaround.js
<script type="text/javascript">
//fixes issue by switching to http for Firefox < 26
//you need jQuery < 1.9 or the jQuery.migrate plugin -
//add this code after the form
if ($.browser.mozilla && $.browser.version < 26){
$('form').attr('action', 'THE_URL_WITH_HTTP_INSTEAD_OF_HTTPS');
hbrandl / MaxLengthTextAreajQueryFallback.js
Last active Dec 20, 2015
jquery fallback function in case a browser doesn't support the maxlength attribute for textareas
View MaxLengthTextAreajQueryFallback.js
/* jquery fallback function in case a browser doesn't support the maxlength attribute for textareas */
based on code by
function count_chars(textarea){
var max = parseInt(textarea.attr('maxlength'));
textarea.parent().find('.charsRemaining').html('<b>' + (max - textarea.val().length) + '</b> characters remaining.');
hbrandl /
Last active Mar 6, 2019 — forked from linjunpop/
Rails flash messages with AJAX requests & twitter-bootstrap
View gist:716956
#FIXXME OpenID still not working
if Rails.env.production?
#overwriting omniauth-347a66e3d4f1/oa-core/lib/omniauth/strategy.rb
module OmniAuth
module Strategy
def full_host
uri = URI.parse(request.url)
uri.path = ''
hbrandl / gist:547170
Created Aug 24, 2010
.irbrc for rails3 (based on
View gist:547170
#making .irbrc posted at
#work with rails3
require 'rubygems'
#rails3: be sure to include wirble and hirb in your Gemfile
require 'wirble'
require 'hirb'
# hirb (active record output format in table)
You can’t perform that action at this time.