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
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 ####
# https://developers.facebook.com/
# FACEBOOK_KEY: ''
# FACEBOOK_SECRET: ''
@hbrandl
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 https://code.google.com/p/gdata-issues/issues/detail?id=4919 by switching to http for Firefox < 26
//you need jQuery < 1.9 or the jQuery.migrate plugin - http://api.jquery.com/jQuery.browser/
//add this code after the form
if ($.browser.mozilla && $.browser.version < 26){
$('form').attr('action', 'THE_URL_WITH_HTTP_INSTEAD_OF_HTTPS');
}
</script>
@hbrandl
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 http://that-matt.com/2008/07/textarea-maxlength-with-jquery/
*/
function count_chars(textarea){
var max = parseInt(textarea.attr('maxlength'));
textarea.parent().find('.charsRemaining').html('<b>' + (max - textarea.val().length) + '</b> characters remaining.');
}
@hbrandl
hbrandl / RailsFlashToHeaders.md
Last active Mar 6, 2019 — forked from linjunpop/README.md
Rails flash messages with AJAX requests & twitter-bootstrap
View RailsFlashToHeaders.md
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
hbrandl / gist:547170
Created Aug 24, 2010
.irbrc for rails3 (based on tech-angels.fr)
View gist:547170
#making .irbrc posted at http://www.tech-angels.fr/post/963080350/improve-irb-and-fix-it-on-mac-os-x
#work with rails3
require 'rubygems'
#rails3: be sure to include wirble and hirb in your Gemfile
require 'wirble'
require 'hirb'
Wirble.init
Wirble.colorize
# hirb (active record output format in table)
You can’t perform that action at this time.