Skip to content

Instantly share code, notes, and snippets.

@antsa
antsa / hyphens.scss
Created August 23, 2011 07:33
Hyphens @mixin for Compass
// Provides a mixin to define hyphenation
//
// Requires Compass
//
// (http://blog.fontdeck.com/post/9037028497/hyphens)
// (http://www.w3.org/TR/css3-text/#hyphenation)
//
// $value - The hyphenation property value. One of "none", "manual", "auto" or "all"
//
// Example .scss:
@donut
donut / functions.php
Last active September 28, 2015 03:58
Fix WordPress asset URLs when a non-absolute base URL is given
<?php
/**
* Fixes URLs to asset files.
*
* If SITE_URL is left blank then WordPress will assume that the SITE_URL is
* the current URL which causes problems when the current URL is not the root
* page. So, instead of linking to
* /wp-content/themes/themename/js/main.js it would link to
* /some-page-name/a-child-page/wp-content/themes/themename/js/main.js which
* breaks things. This attemps to fix this.
@tim-evans
tim-evans / xmpp_cascade_data_source.js
Created December 22, 2011 16:45
Cascade XMPP Data Source
XMPP = {};
// ...............................................
// Models
//
XMPP.BOSHConnection = SC.Record.extend({
primaryKey: 'jid',
jid: SC.Record.attr(String),
password: SC.Record.attr(String),
@ryanohs
ryanohs / gist:2048500
Created March 16, 2012 04:24
Merge Sort - CoffeeScript
mergesort = (input) ->
n = input.length
if n == 1
return input
pivot = Math.floor n/2
a = mergesort input[0...pivot] # coffee script does not include the last element in a slice
b = mergesort input[pivot...n]
merge(a, b)
merge = (a, b) ->
@srsgores
srsgores / ajaxify-html5.js
Created August 11, 2012 08:33 — forked from balupton/README.md
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo
// https://gist.github.com/854622
(function(window,undefined){
// Prepare our Variables
var
History = window.History,
$ = window.jQuery,
document = window.document;
// Check to see if History.js is enabled for our Browser
@tim-evans
tim-evans / document_title.js
Created August 22, 2014 19:28
Document title mixin for Ember.Router
import Ember from "ember";
var get = Ember.get;
var copy = Ember.copy;
var removeObserver = Ember.removeObserver;
var addObserver = Ember.addObserver;
var DocumentTitleMixin = Ember.Mixin.create({
titleTokensDidChange: function () {
@cyril-sf
cyril-sf / gist:515085e856f9dac2f06a
Last active November 13, 2015 22:29
Polymorphic hasMany w/ FixtureAdapter
var User = DS.Model.extend({
messages: DS.hasMany('message', {polymorphic: true})
});
var Message = DS.Model.extend({
user: DS.belongsTo('user'),
body: DS.attr()
});
var Post = Message.extend({
@srsgores
srsgores / less_headers.less
Last active December 11, 2015 09:59
less recursive headers
@em: 1em;
@multiplierLarge: 2.3;
@multiplier: 2;
.headingsX(@index) when (@index > 0) {
(~"h@{index}") {
font-size: ((@em * @multiplierLarge) - ((@index * ((@em * @multiplierLarge) / 6 )))) + (@em * @multiplier);
}
.headingsX(@index - 1);
}
@yoshuawuyts
yoshuawuyts / Stylus heading style
Created June 2, 2013 20:14
Stylus mixin to style headings, not yet supported.
//
// Style any number of headings in one fell swoop:
// This is not yet supported by Stylus, see https://github.com/LearnBoost/stylus/issues/608 for more information.
headings(1..6)
for heading in headings()
h{{heading}}
@content
@interactivellama
interactivellama / jgroup
Created June 3, 2013 17:46
jgroup is a LESS mixin that justifies inline-block elements, removes typography issues by reducing the font-size, and adds a 100% width element to the end simliar to micro-clearfix, but not. Look Ma, no specifying margins! Be carful though of removing spaces / HTML compression in production.
/* Justify inline block elements for a percentage grid without specifying margins: LESS mixin. See http://www.barrelny.com/blog/text-align-justify-and-rwd/ */
.jgroup {
text-align: justify;
font-size: .01px;
&:after{
content: '';
display: inline-block;
width: 100%;