Skip to content

Instantly share code, notes, and snippets.

@rex
rex / bootstrap-navbar.slim
Created August 8, 2014 12:56
Default Twitter Bootstrap nav bar, in the Slim templating language
nav.navbar.navbar-default role="navigation"
.container-fluid
/! Brand and toggle get grouped for better mobile display
.navbar-header
button.navbar-toggle data-target="#bs-example-navbar-collapse-1" data-toggle="collapse" type="button"
span.sr-only Toggle navigation
span.icon-bar
span.icon-bar
span.icon-bar
a.navbar-brand href="#" Brand
@cooljl31
cooljl31 / .gitconfig
Created April 1, 2017 12:35 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
@kurbmedia
kurbmedia / factories.rake
Created January 12, 2011 02:58
Generates FactoryGirl factories.rb from the database tables/columns
namespace :factories do
task :generate => :environment do
# Make a new factory file, moving the old one to factories_old.rb if one exists.
factory_file = "#{Rails.root}/spec/factories"
FileUtils.mv("#{factory_file}.rb", "#{factory_file}_old.rb") if File.exists?("#{factory_file}.rb")
fixture_file = File.open("#{factory_file}.rb", 'w') do |file|
HTML_TAG_REPLACEMENTS = {
'br' => "\n",
}
HTML_QUOTE_REPLACEMENTS = {
'quot' => '"',
'amp' => '&',
}
def strip_html(str, tag = HTML_TAG_REPLACEMENTS, quot = HTML_QUOTE_REPLACEMENTS)
str.gsub %r{
@esbanarango
esbanarango / gist:6629748
Last active May 8, 2018 18:12
HTML <input> required attribute and Rails form with remote true.

<input> with attribute required

This attribute specifies that the user must fill in a value before submitting a form. It cannot be used when the type attribute is hidden, image, or a button type (submit, reset, or button). The :optional and :required CSS pseudo-classes will be applied to the field as appropriate.

How to show a spinner only when the required validations pass? (Without using any validation plugin, only the required attribute).

Form with a required input

= form_for @person, remote: true do |f|
 = f.text_field, :first_name, required: true
@stuross
stuross / gist:1649731
Created January 20, 2012 21:35
hack to fill gaps in masonry
/**
* jQuery Masonry v2.1.01
* A dynamic layout plugin for jQuery
* The flip-side of CSS Floats
* http://masonry.desandro.com
*
* Licensed under the MIT license.
* Copyright 2011 David DeSandro
*/
@StanBoyet
StanBoyet / modal.slim.html
Created September 8, 2014 09:46
Boostrap Modal in Slim
/ Simple Slim translation of Bootstrap modal
.modal.fade.bs-example-modal-lg id="myModal" tabindex='-1' role='dialog' aria-labelledby="Modal Title" aria-hidden='true'
.modal-dialog.modal-lg
.modal-content
.modal-header
button.close type='button' data-dismiss='modal'
span aria-hidden='true' &times;
span.sr-only Close
h4.modal-title = "Modal Title"
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3DataStructure>
<meta type="array">
<langDisable>1</langDisable>
</meta>
<sheets>
<general>
<ROOT type="array">
<TCEforms>
<sheetTitle>Einstellungen</sheetTitle>
@vishaltelangre
vishaltelangre / blur.css
Created April 17, 2014 09:34
cross browser blur filter using css
.blur {
-webkit-filter: blur(3px);
-moz-filter: blur(3px);
-ms-filter: blur(3px);
-o-filter: blur(3px);
/* FF doesn't support blur filter, but SVG */
filter: url("data:image/svg+xml;utf8,<svg height='0' xmlns='http://www.w3.org/2000/svg'><filter id='svgBlur' x='-5%' y='-5%' width='110%' height='110%'><feGaussianBlur in='SourceGraphic' stdDeviation='5'/></filter></svg>#svgBlur");
filter: progid: DXImageTransform.Microsoft.Blur(PixelRadius = '3');
filter: blur(3px);
}
@brosner
brosner / setup.md
Last active April 26, 2020 11:32
My development environment setup

Prepare by switching out of bash from Homebrew:

chsh -s /bin/zsh

To clean my system and reinstall Homebrew:

rm -rf ~/.local && mkdir ~/.local
rm -rf ~/Library/Caches/pip
rm -rf ~/.pyenv

rm -rf ~/.yarn