Skip to content

Instantly share code, notes, and snippets.

View hbrandl's full-sized avatar

Hartwig Brandl hbrandl

View GitHub Profile
@hbrandl
hbrandl / application.yml
Created August 5, 2014 12:21
application.yml to be used with hbrandl/rails_with_login
# 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 December 27, 2015 03:19
JS that fixes the YouTube-API V2 Browser Upload for Firefox < 26
<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 December 20, 2015 06:59
jquery fallback function in case a browser doesn't support the maxlength attribute for textareas
/* 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 November 2, 2023 11:57 — forked from linjunpop/README.md
Rails flash messages with AJAX requests & twitter-bootstrap
@hbrandl
hbrandl / gist:716956
Created November 26, 2010 16:59 — forked from xxx/gist:706255
#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 August 24, 2010 08:09
.irbrc for rails3 (based on tech-angels.fr)
#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)