Skip to content

Instantly share code, notes, and snippets.

View juliankrispel's full-sized avatar

Julian Krispel juliankrispel

View GitHub Profile
@juliankrispel
juliankrispel / jquery.textfill.js
Created October 24, 2012 10:10
jQuery Plugin to resize text to fit container
(function($) {
$.fn.textfill = function(maxFontSize) {
maxFontSize = parseInt(maxFontSize, 10);
return this.each(function(){
var ourText = $("span", this);
function resizefont(){
var parent = ourText.parent(),
maxHeight = parent.height(),
maxWidth = parent.width(),
fontSize = parseInt(ourText.css("fontSize"), 10),
@juliankrispel
juliankrispel / git_dreamhost_deploy.sh
Created April 16, 2016 03:44
git dreamhost deploy
#!/bin/sh
#
# This hook does two things:
#
# 1. update the "info" files that allow the list of references to be
# queries over dumb transports such as http
#
# 2. if this repository looks like it is a non-bare repository, and
# the checked-out branch is pushed to, then update the working copy.
# This makes "push" function somewhat similarly to darcs and bzr.
@juliankrispel
juliankrispel / vim_cheatsheet.md
Created January 23, 2014 10:08
vim cheatsheet

" Don't quit visual mode after indenting :vmap < >gv

@juliankrispel
juliankrispel / angular-drag-events.js
Last active December 31, 2015 14:38
simple drag events as angular directives
var directives = ['drag', 'dragstart', 'dragend', 'dragover', 'dragenter', 'drop'];
// The HTML5 drag and drop api is the most stupid thing
// I've ever seen, but I'm going to use it anyway.
angular.forEach(directives, function(dir){
app.directive(dir, [function () {
return {
restrict: "A",
scope: false,
@juliankrispel
juliankrispel / dragAndDropLayoutSpec.md
Last active December 31, 2015 01:19
drag and drop layout blocks (spec)

Drag and Drop Layouts

Outline

A document would be simply, an array of objects, visually sortable through a drag and drop interface.

Each object in this array represents a draggable html element rendered on the page. When dragged over another the aforementioned array is resorted. Whenever the array resorts, it will rerender its' contents to the page.

An example of the array of objects that represents a document

documentA = [
@juliankrispel
juliankrispel / quicksort.coffee
Created October 28, 2013 07:05
A quicksort implementation in CoffeeScript
arr = [900, 1, 39, 12, 8, 15, 39, 11, 100]
quicksort = (arr) ->
if(arr.length < 2)
return arr
unless arr or arr.length > 1
throw new Error 'Input invalid'
pivot = arr[0]
@juliankrispel
juliankrispel / bootstrap_sucks.md
Created October 11, 2013 15:47
Actual examples of why bootstrap sucks

Try extending an item with the class control-label with the class text-left, what do you think will happen?

<label class="text-left control-label">Label</label>

Think the label will be left alligned? No!

@juliankrispel
juliankrispel / css-frameworks-comparison.md
Created September 17, 2013 10:19
CSS Frameworks - A comparison

CSS Frameworks Comparison

I wrote a little scripts that shows [some stats about the frameworks](http://juliankrispel.github.io/css-specificity-benchmark/]

##Twitter Bootstrap Size: 16KB Bootstrap seems to be the default for many developers and startups. And I can see why. It has a boatload of fully designed, fully functional components (Not only CSS, also Javascript). It's biggest strength is however also its biggest weakness. Because Bootstrap is so fully featured and so 'designed' already, by picking it you are buying into their way of doing things. Although they vastly improved in their 3.0 release, Bootstrap still struggles with a high rate of specificity which make it hard to extend.

The new version of bootstrap has major advantages over 2.3.2. They shaved off 30% of it's codebase without feature-reduction and is 14% less specific than its predecessor.

var getType = function(thing){
if(thing === null) return "[object Null]";
return Object.prototype.toString.call(thing);
}
// Determines whether all properties of data are contained in containsData
var deepContains = function contains(data, containsData ) {
for (var i in data){
var key = i;
if(key.indexOf('not_') === 0){
@juliankrispel
juliankrispel / vimbits.md
Last active December 17, 2015 13:48
Nice little things in vim