Skip to content

Instantly share code, notes, and snippets.

@ohanhi
ohanhi / frp.md
Last active September 23, 2025 16:12
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note

@frankwiles
frankwiles / blocks.py
Created May 17, 2015 03:13
Code and Markdown blocks for Wagtail 1.0 StreamField
from django.utils.safestring import mark_safe
from markdown import markdown
from pygments import highlight
from pygments.formatters import get_formatter_by_name
from pygments.lexers import get_lexer_by_name
from wagtail.wagtailcore import blocks
class CodeBlock(blocks.StructBlock):
var active = false;
function changeRefer(details) {
if (!active) return;
for (var i = 0; i < details.requestHeaders.length; ++i) {
if (details.requestHeaders[i].name === 'Referer') {
details.requestHeaders[i].value = 'http://www.google.com/';
break;
}
@paulirish
paulirish / bling.js
Last active September 13, 2025 12:13
bling dot js
/* bling.js */
window.$ = document.querySelector.bind(document);
window.$$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); };
NodeList.prototype.__proto__ = Array.prototype;
NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); };
@imjasonh
imjasonh / markdown.css
Last active September 3, 2025 22:12
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@tmtlbt
tmtlbt / gist:e86a7511f2a63421b018
Created February 25, 2015 10:04
Wagtail Map Template Include
{% block extra_js %}
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key={{ GOOGLE_MAPS_KEY }}"> </script>
<script type="text/javascript">
var pages = [];
{% for page in pages %}
pages.push([
{{ page.location.latitude }},
{{ page.location.longitude }},
"{{ page.title }}",
"{{ page.text }}"
@tmtlbt
tmtlbt / gist:ed3715f0047b4775f265
Created February 25, 2015 10:02
Wagtail Map Locatable Mixin
class Locatable(models.Model):
location_name = models.CharField(
max_length=255,
blank=True)
location = models.ForeignKey(
'home.Location',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+',
@iangreenleaf
iangreenleaf / gist:b206d09c587e8fc6399e
Last active September 5, 2025 19:33
Rails naming conventions

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

Git Cheat Sheet

Commands

Getting Started

git init

or