Skip to content

Instantly share code, notes, and snippets.

View isGabe's full-sized avatar
👨‍💻
:party-code:

Gabriel Luethje isGabe

👨‍💻
:party-code:
View GitHub Profile
@veeracs
veeracs / ellipsis.js
Last active September 28, 2016 22:31
Ellipsis
(function ellipsis(str, charLimit) {
var result = [];
var letters = 0;
str.split(' ').forEach(function(word, index) {
if (letters < charLimit) {result.push(word)}
letters += word.length;
});
console.log(result.join(' ') + ' ...');
})("Hero congressman calls out conservatives on racist abortion restrictions", 40);
@davatron5000
davatron5000 / icon-grid.html
Created January 14, 2015 21:27
SVG Icon Grid
<div id="styleguide-icon-grid"></div>
<object data="/assets/icons.svg" id="svgembed" height=0; width=0></object>
<script>
var grid = document.querySelector('#styleguide-icon-grid');
var tmpl = '<div class="item"><svg class="icon"><use xlink:href="/assets/icons.svg#{id}"></use></svg><span>#{id}</span></div>';
function svgloaded() {
var svgEmbed = document.querySelector("#svgembed");
var svg = svgEmbed.getSVGDocument();
@davatron5000
davatron5000 / gulp-svgstore.js
Last active May 13, 2019 05:48
Gulpin' SVGz
var cheerio = require('gulp-cheerio');
var svgmin = require('gulp-svgmin');
var svgstore = require('gulp-svgstore');
gulp.task('svgstore', function () {
return gulp
.src('assets/icons/*.svg')
.pipe(svgmin())
.pipe(svgstore({ fileName: 'icons.svg', prefix: 'icon-' }))
.pipe(cheerio({
@scottjehl
scottjehl / fonts.js
Created April 17, 2013 19:04
current font loading snippet
...
// test for font-face version to load via Data URI'd CSS
// Basically, load WOFF unless it's android's default browser, which needs TTF, or ie8-, which needs eot
var fonts = ns.files.css.fontsWOFF,
ua = win.navigator.userAgent;
// android webkit browser, non-chrome
if( ua.indexOf( "Android" ) > -1 && ua.indexOf( "like Gecko" ) > -1 && ua.indexOf( "Chrome" ) === -1 ){
fonts = ns.files.css.fontsTTF;
}
@duanecilliers
duanecilliers / wp-bootstrap-walker-class.php
Created February 13, 2012 14:45
Extended Walker Class for Twitter Bootsrap Navigation Wordpress Integration
<?php
class Bootstrap_Walker_Nav_Menu extends Walker_Nav_Menu {
function start_lvl( &$output, $depth ) {
//In a child UL, add the 'dropdown-menu' class
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent<ul class=\"dropdown-menu\">\n";