Skip to content

Instantly share code, notes, and snippets.

View rn0's full-sized avatar
:bowtie:
testing

Piotr Kapera rn0

:bowtie:
testing
View GitHub Profile
class User < ActiveRecord::Base
attr_accessible :name
has_many :admin_memberships, class_name: "Membership", conditions: {role: 'admin'}
has_many :editor_memberships, class_name: "Membership", conditions: {role: 'editor'}
def admin?
admin_memberships.exists?
end
@rn0
rn0 / README.markdown
Created April 25, 2012 18:59 — forked from gudbergur/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@rn0
rn0 / README.markdown
Created April 25, 2012 18:58 — forked from gudbergur/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@rn0
rn0 / README.markdown
Created April 3, 2012 17:40 — forked from Yavari/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@rn0
rn0 / README.markdown
Created April 3, 2012 17:40 — forked from Yavari/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@rn0
rn0 / bootstrap-grid.css
Created March 3, 2012 19:36 — forked from abitgone/bootstrap-grid.css
Grid Overlay for Twitter Bootstrap
/*
* Grid Overlay for Twitter Bootstrap
* Assumes a 1.692em baseline grid (22px/13px)
*/
@media (min-width: 1200px) {
body {
background: -webkit-linear-gradient(
90deg,
rgba(0,0,0,0.05),
rgba(0,0,0,0.05) 4.545%,
@rn0
rn0 / form.html
Created March 1, 2012 14:31 — forked from patashnik/form.html
Forms "dynamic" validators
<form method="post">
<div>
<label>First <input type="radio" name="choice" value="1" /></label>
<input type="text" name="first_text" />
</div>
<div>
<label>Second <input type="radio" name="choice" value="2" /></label>
<input type="text" name="second_text" />
</div>
</form>
@rn0
rn0 / README.markdown
Created February 20, 2012 00:22 — forked from gudbergur/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is an extension to Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@rn0
rn0 / jquery.elastic.js
Last active October 1, 2016 06:09
My version of the jquery elastic plugin. Let's you update the textarea height whenever you feel. Original: http://www.unwrongest.com/projects/elastic/.
/**
* @name Elastic+
* @descripton grow and shrink your textareas automatically
*
* @author Casey W. Stark
* @author-email casey@thestarkeffect.com
* @author-website http://thestarkeffect.com
*
* @license MIT License - http://www.opensource.org/licenses/mit-license.php
*
@rn0
rn0 / remote-typeahead.js
Created February 16, 2012 23:45 — forked from geuis/remote-typeahead.js
Remote data querying for Twitter Bootstrap 2.0 Typeahead without modifications
// Charles Lawrence - Feb 16, 2012. Free to use and modify. Please attribute back to @geuis if you find this useful
// Twitter Bootstrap Typeahead doesn't support remote data querying. This is an expected feature in the future. In the meantime, others have submitted patches to the core bootstrap component that allow it.
// The following will allow remote autocompletes *without* modifying any officially released core code.
// If others find ways to improve this, please share.
var autocomplete = $('#searchinput').typeahead()
.on('keyup', function(ev){
ev.stopPropagation();
ev.preventDefault();