Skip to content

Instantly share code, notes, and snippets.

View Shipow's full-sized avatar
💦
Sweating for release!

Kevin Granger Shipow

💦
Sweating for release!
View GitHub Profile
@Shipow
Shipow / FloatClearing.sass
Created March 10, 2014 16:48
Sass - Float Clearing
@mixin clear()
&:before, &:after
content: "\0020"
display: block
height: 0
overflow: hidden
&:after
clear: both
@Shipow
Shipow / cdn-fallback.js
Created April 9, 2014 07:58
CDN fallback
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>
<script>
window.jQuery || document.write('<script src="js/libs/jquery-1.7.1.min.js">\x3C/script>')
</script>
@Shipow
Shipow / vertical-align.sass
Created July 26, 2014 15:10
Sass - Vertical Align
.parent-element
-webkit-transform-style: preserve-3d
-moz-transform-style: preserve-3d
transform-style: preserve-3d
@mixin vertical-align
position: relative
top: 50%
-webkit-transform: translateY(-50%)
-ms-transform: translateY(-50%)
@Shipow
Shipow / ng-lazy-load
Last active August 29, 2015 14:16
Angular Lazy load images with cache detection
app.directive('imgPreload', ['$timeout', function($timeout) {
return {
restrict: 'A',
scope: {
ngSrc: '@'
},
link: function(scope, element, attrs) {
var loaded = false;
element.on('load', function() {
loaded = true;
@Shipow
Shipow / tsvtojson.js
Created March 16, 2015 14:06
TSV to JSON
var tsvToJson = function(input){
var info = input.replace(/['"]/g,''),
lines = info.split('\n'),
firstLine = lines.shift().split('\t'),
json = [];
// Helper function to remove quotes
// and parse numeric values
var removeQuotes = function(string){
string = string.replace(/(['"])/g, "\\$1");
@Shipow
Shipow / humanize.js
Last active August 29, 2015 14:17 — forked from maggiben/humanize.js
angular.module('humanize', [])
.filter('humanize', function(){
return function humanize(number) {
if(number < 1000) {
return number;
}
var si = ['K', 'M', 'G', 'T', 'P', 'E'];
var exp = Math.floor(Math.log(number) / Math.log(1000));
var result = number / Math.pow(1000, exp);
result = (result % 1 > (1 / Math.pow(1000, exp - 1))) ? result.toFixed(2) : result.toFixed(0);
@Shipow
Shipow / toFixedNumber.js
Created August 4, 2015 13:13
Native like function to return number with fixed float
Number.prototype.toFixedNumber = function(x, base){
var pow = Math.pow(base||10,x);
return +( Math.round(this*pow) / pow );
}
@Shipow
Shipow / _pems.scss
Created December 7, 2012 00:59 — forked from mrdanadams/_pems.scss
PX to EMs conversion in Sass
/* See http://mrdanadams.com/2012/pixel-ems-css-conversion-sass-mixin/ */
/* Default font size in pixels if not overridden. */
$baseFontSize: 16;
/* Convert PX units to EMs.
Ex: margin-right: pem(16);
*/
@function pem($pxval, $base: $baseFontSize) {
@return #{$pxval / $base}em;
@Shipow
Shipow / gist:4691434
Created February 1, 2013 13:55
How to get size of mysql database
SELECT table_schema "DB Name", sum( data_length + index_length ) / 1024 / 1024 "DB Size in MB"
FROM information_schema.TABLES GROUP BY table_schema ;
@Shipow
Shipow / index.html
Created August 15, 2013 17:06
A CodePen by Lego Mushroom. Touch device jelly menu concept - What would you like to eat today? Will be great x with native implementation on touch devices My inspiration started here http://capptivate.co/2013/07/12/making-3/ Most of icons are Ashleigh Brennan's http://dribbble.com/ash-brennan Tried to explain it here: http://coding.smashingmaga…
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" type="text/css" href="css/main.css">
<!-- <meta name="viewport" content="initial-scale = 1.0, maximum-scale = 1.0, user-scalable = no, width = device-width">-->
</head>
<body>
<div class="suggest-l"></div>