I hereby claim:
- I am chrise86 on github.
- I am chrisedwards (https://keybase.io/chrisedwards) on keybase.
- I have a public key whose fingerprint is 5D2F 502D 07D4 F2E2 1CD1 10AA C8CB 36A0 219B 6E85
To claim this, I am signing this object:
# This concern enables namespaces in Pundit. In order to use it, put this | |
# module into the `app/controllers/concerns` folder of your project and then | |
# include the module into the controller you want to namespace the policies in | |
# after the include of Pundit. | |
# | |
# To secify the namespace to use, overwrite the `pundit_namespace` method on | |
# your controller then. | |
# | |
# Example | |
# ======= |
class ActiveRecord::Base | |
mattr_accessor :shared_connection | |
@@shared_connection = nil | |
def self.connection | |
@@shared_connection || ConnectionPool::Wrapper.new(:size => 1) { retrieve_connection } | |
end | |
end | |
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection |
# | |
# DO NOT EXPECT THIS WILL RUN AS SHOWN HERE! | |
# This is an extract from https://github.com/iboard/yarb | |
# The specs will work only in the full environment of the application. | |
# | |
# Anyhow, this example should show you how to define a Boolean-value | |
# for ruby. | |
# | |
# Because HTML-Forms will post checkbox-values as "0"/"1" rather than false/true | |
# this class will handle 0,"0",false as FalseValue, and 1,"1",true as TrueValue |
#config/initializers/carrierwave.rb | |
module CarrierWave | |
module MiniMagick | |
# Rotates the image based on the EXIF Orientation | |
def exif_rotation | |
manipulate! do |img| | |
img.auto_orient | |
img = yield(img) if block_given? | |
img | |
end |
I hereby claim:
To claim this, I am signing this object:
# db/migrate/XXXXXXXXXXXXX_add_authentication_token_to_users.rb | |
class AddAuthenticationTokenToUsers < ActiveRecord::Migration | |
def change | |
add_column :users, :authentication_token, :string | |
add_index :users, :authentication_token, :unique => true | |
end | |
end |
require 'open-uri' | |
require 'ipaddr' | |
def generate_lookup_table | |
delegation_lists = [ | |
'ftp://ftp.afrinic.net/pub/stats/afrinic/delegated-afrinic-latest', | |
'ftp://ftp.apnic.net/pub/stats/apnic/delegated-apnic-latest', | |
'ftp://ftp.arin.net/pub/stats/arin/delegated-arin-latest', | |
'ftp://ftp.lacnic.net/pub/stats/lacnic/delegated-lacnic-latest', | |
'ftp://ftp.ripe.net/pub/stats/ripencc/delegated-ripencc-latest' |
function urlFromHash() { | |
if (location.hash.substr(0, 2) != '#!') { | |
return null; | |
} | |
// why not location.hash? => http://stackoverflow.com/q/4835784/298479 | |
return location.href.split('#')[1].substr(1); | |
} | |
$('#gallery').magnificPopup({ | |
type: 'image', |
array( | |
'url' => '...', | |
'title' => '...', | |
'author' => '...', | |
'id' => 123 // the new item | |
) |
<!DOCTYPE html> | |
<!--[if IE 8]> <html lang="sv-SE" class="no-js ie8"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html lang="sv-SE" class="no-js"> <!--<![endif]--> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Breakpoint detection test</title> | |
<style type="text/css" media="screen"> | |
@media screen and (min-width: 320px) { | |
#page:after { | |
content: 'smallest'; /* represent the current width-bracket */ |