Skip to content

Instantly share code, notes, and snippets.

Avatar
🥾
Shoemaking

Cory LaViska claviska

🥾
Shoemaking
View GitHub Profile
@claviska
claviska / vertically-centered-bootstrap-modals.js
Last active May 15, 2020
Vertically Centered Bootstrap Modals
View vertically-centered-bootstrap-modals.js
/**
* Vertically center Bootstrap 3 modals so they aren't always stuck at the top
*/
$(function() {
function reposition() {
var modal = $(this),
dialog = modal.find('.modal-dialog');
@claviska
claviska / jquery.offscreen.js
Created Oct 30, 2013
jQuery offscreen plugin
View jquery.offscreen.js
/*
* jQuery offscreen plugin
*
* Filters that detect when an element is partially or completely outside
* of the viewport.
*
* Usage:
*
* $('#element').is(':off-bottom')
*
@claviska
claviska / pretty-buttons.less
Last active Oct 24, 2019
A Less mixin' for pretty buttons with Bootstrap 3
View pretty-buttons.less
.pretty-buttons(@color, @background, @text-shadow: none) {
color: @color;
#gradient > .vertical(lighten(@background, 5%), darken(@background, 5%), 0%, 100%);
border-color: darken(@background, 10%);
border-bottom-color: darken(@background, 20%);
text-shadow: @text-shadow;
.box-shadow(inset 0 1px 0 rgba(255, 255, 255, .1));
&:hover,
@claviska
claviska / parseTime.js
Last active Feb 10, 2017
Parse time strings input by humans
View parseTime.js
function parseTime(time, format, step) {
var hour, minute, stepMinute,
defaultFormat = 'g:ia',
pm = time.match(/p/i) !== null,
num = time.replace(/[^0-9]/g, '');
// Parse for hour and minute
switch(num.length) {
case 4:
@claviska
claviska / rest.class.php
Created Aug 30, 2012
Barebones PHP-based REST client
View rest.class.php
<?php
/*
Usage:
$rest = new REST($config);
$result = $rest->get('http://example.com/method, array(
'name' => 'value',
...
));
You can’t perform that action at this time.