Skip to content

Instantly share code, notes, and snippets.

@henrahmagix
henrahmagix / Gruntfile.js
Last active August 29, 2015 14:06
Test font awesome in grunt-webfont
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-webfont');
grunt.initConfig({
webfont: {
icons: {
src: 'black/svg/file-{audio,image,movie,pdf,excel,archive,word}-o.svg',
dest: 'icons',
destCss: 'css/',
// Parse the value returned by $.css('-webkit-transform')
var parseTranslationValue = function (value, suffix, axis) {
if (angular.isUndefined(value) || value === '') {
// return early if value isn't passed.
return 0;
} else {
// Default suffix value.
if (angular.isUndefined(suffix)) {
suffix = '';
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e
@henrahmagix
henrahmagix / nested-counter-reset.html
Last active August 29, 2015 14:10
How counter-reset works through nested lists.
<html>
<head>
<title>Nested counter-reset styles</title>
<style type="text/css">
ol,
ul {
list-style: none;
counter-reset: listStyle;
margin: 1em 0;
@henrahmagix
henrahmagix / no-break-space.md
Last active August 29, 2015 14:13
No-break spaces don't work in Markdown titles in GitHub comments

See comment below. (It renders fine here but shows an indentation.)

Screenshot:

image

In the atom editor, a no-break space (alt+space on OSX) is shown as a small dot.

image

@henrahmagix
henrahmagix / mobile-webapp.html
Last active August 29, 2015 14:14
If setting the meta charset, does that define it for all links?
<!-- Charset is in http-equiv -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Does Charset have to be defined in an attribute? -->
<link type="text/css" charset="utf-8" rel="stylesheet" href="media/styles/application.css" />
{
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
"CVS",
".sass-cache"
],
"ensure_newline_at_eof_on_save": true,
.DS_Store
*.pyc
*.sw[o|p]
*.un~
.project
.rvmrc
._*
.venv
.ropeproject
.sass-cache
@henrahmagix
henrahmagix / canvas.js
Created February 20, 2015 14:54
Canvas angular module beginnings
(function (angular, _) {
'use strict';
var module = angular.module('canvas', [
'swipe'
]);
// In your article:
// <div canvas-circle value="0" min="0" max="100"></div>
app.directive('canvasCircle', [
@henrahmagix
henrahmagix / angular-event-bus.js
Last active August 29, 2015 14:17
A method for using $rootScope as a global events bus. Currently leaky: need to delete events after deregistration.
app.service('AppEvents', [
'$rootScope', '$log',
function ($rootScope, $log) {
// Store for callback functions.
this._events = {};
// Deregister an event.
var deregister = function (offFunc) {
if (offFunc) {