Skip to content

Instantly share code, notes, and snippets.

@Traz
Traz / gist:5279557
Last active December 15, 2015 15:09
Some attempt to build a nice PRY set up file :) .pryrc
Pry.config.auto_indent = true
Pry.config.color = true
Pry.config.editor = "vim"
#Pry.config.prompt = Pry::DEFAULT_PROMPT
Pry.config.history.file = "~/pry_history"
Pry.config.hooks.add_hook(:before_session, :say_hi_lazza) do
puts "\n\nHi Traz !\nRuby#{RUBY_VERSION}\n\n"
end
Pry.config.hooks.add_hook(:after_session, :say_bye_lazza) do
puts "\n\nbye-bye Traz !\n\n"
@kraz
kraz / make.bat
Last active March 13, 2019 16:52
Windows batch for simulating twitter bootstrap make functionality
@echo off
SET BOOTSTRAP=.\docs\assets\css\bootstrap.css
SET BOOTSTRAP_LESS=.\less\bootstrap.less
SET BOOTSTRAP_RESPONSIVE=.\docs\assets\css\bootstrap-responsive.css
SET BOOTSTRAP_RESPONSIVE_LESS=.\less\responsive.less
SET "CHECK= "
SET HR=##################################################
::Try to use the local build tools, if installed instead of global ones
@gerrywastaken
gerrywastaken / compas-bootstrap-box-shadow.css.sass
Created June 12, 2012 20:08
Some simple mixins that allow you to add Bootstrap's box shaddow styling to other classes that Bootstrap doesn't address.
@import "compass/css3/box-shadow"
@import "compass/css3/transition"
$bs-box-shadow-default-color: rgba(0, 0, 0, 0.075)
$bs-box-shadow-focus-color: rgb(82, 168, 236)
@mixin bs-default-box-shadow
@include box-shadow(inset 0 1px 1px $bs-box-shadow-default-color)
@mixin bs-box-shadow
// jQuery.FullScreen plugin
// Triple-licensed: Public Domain, MIT and WTFPL license - share and enjoy!
(function($) {
function isFullScreen() {
return document[!prefix ? 'fullScreen' :
'webkit' === prefix ? 'webkitIsFullScreen' :
prefix + 'FullScreen'];
}
@postpostmodern
postpostmodern / rails_bootstrap_delete_confirmation_modal.md
Created February 19, 2012 07:38 — forked from trey/rails_bootstrap_delete_confirmation_modal.md
A nice delete confirmation modal in Rails courtesy of Bootstrap

Here's what you get.

Some CoffeeScript (verbosely commented for clarity)

# Override Rails handling of confirmation

$.rails.allowAction = (element) ->
  # The message is something like "Are you sure?"
  message = element.data('confirm')
@chrisbloom7
chrisbloom7 / README.md
Created June 6, 2011 07:16
A cheap knock off of the default validates_length_of validator, but checks the filesize of a Carrierwave attachment

Note that this validation runs both after the file is uploaded and after CarrierWave has processed the image. If your base uploader includes a filter to resize the image then the validation will be run against the resized image, not the original one that was uploaded. If this causes a problem for you, then you should avoid using a resizing filter on the base uploader and put any specific size requirements in a version instead.

So instead of this:

require 'carrierwave/processing/mini_magick'

@mhenrixon
mhenrixon / _form.html.haml
Created May 18, 2011 11:02
A complete sample of how to perform nested polymorphic uploads in rails using carrierwave
=semantic_form_for [:admin, @dog], validate: true, html: {multipart: true} do |f|
=f.inputs do
=f.input :name
=f.input :kennel_name
=f.input :birthdate
=f.input :gender, as: :radio, collection: {'Tik' => 'F', 'Hane' => 'M'}
=f.input :father_id, as: :select, collection: @dogs
=f.input :mother_id, as: :select, collection: @bitches
=f.semantic_fields_for :pictures do |pic|