Skip to content

Instantly share code, notes, and snippets.

View emilbjorklund's full-sized avatar

Emil Björklund emilbjorklund

View GitHub Profile
@huobazi
huobazi / gist:997492
Created May 29, 2011 05:09 — forked from dstufft/gist:997475
Configuration Files for Nginx + Gunicorn + Supervisord
We couldn’t find that file to show.
@dreamiurg
dreamiurg / fabfile.py
Created July 25, 2011 08:40
fabfile.py for webfaction and vagrant
"""
This fabric file makes setting up and deploying a django application much
easier to webfaction servers or your dedicated server, but it does make a
few assumptions. Namely that you're using Git, Apache and mod_wsgi. Also
you should have SSH installed on both the local machine and any servers you
want to deploy to.
Thanks to:
http://github.com/ryanmark/django-project-templates
@aarongustafson
aarongustafson / dependent-anchor-include.js
Last active December 19, 2015 01:38
Scott Jehl’s Anchor Include Pattern (https://gist.github.com/scottjehl/d0e4918cf5e97edf99f3) combined with Emil Bjorkund’s Width Detection (https://gist.github.com/emilbjorklund/2481019)
/*! Dependent Anchor Include Pattern */
/*
* Copyright 2011, Scott Jehl (scottjehl.com), Emil Bjorklund (thatemil.com),
* and Aaron Gustafson (aaron-gustafson.com)
*
* Dual licensed under the MIT
* Idea from Scott Gonzalez
*
* to use, place attributes on an already-functional anchor pointing to content
* that should either replace, or insert before or after that anchor
@adactio
adactio / webmention.php
Last active March 16, 2024 22:15
Minimum viable webmention in PHP.
<?php
# Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
# http://creativecommons.org/publicdomain/zero/1.0/
if (!isset($_POST['source']) || !isset($_POST['target'])) {
header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
exit;
}
@voxpelli
voxpelli / SASS_Calculcate_Alpha.md
Last active September 26, 2018 21:00
Pure SASS script for calculating the needed alpha channel of a top color to result in a target color on top of a specified bottom color.

A pure SASS-script to calculate what alpha channel that is needed for a color to achieve a certain target color when rendered on top of a specified bottom color.

This can be useful when extracting colors from a flat image where you can estimate two colors that are rendered on top of another, but need help with figuring out the alpha number of the top color to achieve the target color in the image.

Imagine eg. a sligthly transparent black box on top of an image. By color picking to adjacent pixels on the corner of the box – the one outside the box as the bottom color and the one in the box as the target color – and then specifying the top color as black and putting all of thos colors into this function – then you'll get back the approximate alpha color needed to achieve the wanted result.

Update 1: Addaded a function for also calculating what color to use to achieve a specific target color when the alpha channel is known (perhaps you have calculated the alpha for an adjacent element and want to figure out w

@hdragomir
hdragomir / sm-annotated.html
Last active June 13, 2024 03:01
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@younes0
younes0 / RateLimitSubscriber.php
Last active December 4, 2015 09:13
Rate Limit Subscriber for Guzzle 4.x + Laravel
<?php
/**
* Todo: Decouple from Laravel's Caching system
**/
use GuzzleHttp\Collection;
use GuzzleHttp\Event\BeforeEvent;
use GuzzleHttp\Event\CompleteEvent;
use GuzzleHttp\Event\EmitterInterface;
@p3t3r67x0
p3t3r67x0 / pseudo_elements.md
Last active January 16, 2024 01:17
A CSS pseudo-element is used to style specified parts of an element. In some cases you can style native HTML controls with vendor specific pseudo-elements. Here you will find an list of cross browser specific pseudo-element selectors.

Styling native elements

Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element or the /deep/ path selector.

video::webkit-media-controls-timeline {
  background-color: lime;
}

video /deep/ input[type=range] {