Skip to content

Instantly share code, notes, and snippets.

@lou
lou / searchable.hmtl
Created Apr 3, 2012
searchable multiselect
View searchable.hmtl
<body>
<select name="countries[]" multiple="multiple" id="searchable-select">
<option value="fr" selected="selected">France</option>
<option value="ca">Canada</option>
<option value="ar">Argentina</option>
<option value="pt">Portugal</option>
<option value="us">United States</option>
<option value="gb">United Kingdom</option>
<option value="au">Australia</option>
<option value="ao">Angola</option>
@lou
lou / searchable.js
Created Apr 3, 2012
multiselect searchable
View searchable.js
$('#searchable-form').multiSelect({
selectableHeader : '<input type="text" id="search" autocomplete = "off" />'
});
$('input#search').quicksearch('#ms-searchable-form .ms-selectable li');
@lou
lou / gmap-fullscreen.js
Created Jan 2, 2012
Google map Fullscreen with jQuery
View gmap-fullscreen.js
$(function() {
var map = new google.maps.Map(document.getElementById("map_canvas"), {});
var newyork = new google.maps.LatLng(40.69847032728747, -73.9514422416687);
var googleMapWidth = $("#map_canvas").css('width');
var googleMapHeight = $("#map_canvas").css('height');
map.setCenter(newyork);
$('#enter-full-screen').click(function(){
@lou
lou / deactivate-selected-elem.js
Created Sep 28, 2011
deactivate selected element in multiselect
View deactivate-selected-elem.js
$('.multiselect').multiSelect({
afterSelect: function(value){
if (1 == 1){
var selectedLi = $('.ms-elem-selected[ms-value="'+value+'"]').first();
selectedLi.unbind('click');
selectedLi.addClass('beautiful-disabled-class');
}
}
});
@lou
lou / searchable-multiselect.js
Created Sep 14, 2011
searchable multiselect
View searchable-multiselect.js
$('#searchable-form').multiSelect({
selectableHeader : '<input type="text" id="search" />'
});
$('input#search').quicksearch('#ms-searchable-form .ms-selectable li');
@lou
lou / multiselect-collapse
Created Aug 24, 2011
multiselect optgroup collapsable
View multiselect-collapse
$('#ms-YOUR_SELECT_ID .ms-selectable').find('li.ms-elem-selectable').hide();
$('.ms-optgroup-label').click(function(){
$(this).nextAll('li').toggle();
});
@lou
lou / uninstall all gems
Created Jul 7, 2011
uninstall all gems
View uninstall all gems
for i in `gem list --no-versions`; do gem uninstall -Ia $i; done
View dropdowns.js
$(document).click(function(e) {
if ($(e.target).closest('.toggle').length > 0){
e.preventDefault();
var target = target.closest('.toggle');
if (target.hasClass('menuOn')){
$('.toggle').removeClass('menuOn');
target.closest('.dropdown').find('.menu').hide('fast');
} else {
$('.toggle').removeClass('menuOn');
$('.dropdown .menu').hide();