Skip to content

Instantly share code, notes, and snippets.

View mrmartineau's full-sized avatar
👋
Aho Young Warrior

Zander Martineau mrmartineau

👋
Aho Young Warrior
View GitHub Profile
@mrmartineau
mrmartineau / .htaccess
Created November 18, 2017 22:32 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@mrmartineau
mrmartineau / bling.js
Created November 18, 2017 22:30 — forked from paulirish/bling.js
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@mrmartineau
mrmartineau / certificate.sh
Created November 18, 2017 22:30 — forked from WebReflection/certificate.sh
A basic Self Signed SSL Certificate utility
#!/usr/bin/env bash
# A basic Self Signed SSL Certificate utility
# by Andrea Giammarchi @WebReflection
# https://www.webreflection.co.uk/blog/2015/08/08/bringing-ssl-to-your-private-network
# # to make it executable and use it
# $ chmod +x certificate
# $ ./certificate # to read the how-to
@mrmartineau
mrmartineau / array_iteration_thoughts.md
Last active November 22, 2022 15:10 — forked from ggauravr/array_iteration_thoughts.md
Array iteration methods summarized

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and

@mrmartineau
mrmartineau / git.sh
Created November 18, 2017 22:15
Various git commands
git push origin --delete branch1 branch2
@mrmartineau
mrmartineau / themes.html
Created January 20, 2017 06:56
From my blog post: Creating dynamic layouts with Jekyll
<style>
.hero {
background-color: {{ page.style.color.primary }};
color:{{ page.hero.color }};
background-image: url({{ site.assets.imgPath }}{{ page.hero.bg }}?w=500&{{ site.assets.params }});
}
.hero-title {
color: {{ page.hero.color }};
}
.hero-link {
@mrmartineau
mrmartineau / section-module.mustache
Created January 20, 2017 06:25
From my blog post: Creating dynamic layouts with Jekyll Raw
<section class="section{%if include.spaced %} section--spaced{% endif %}{%if include.padded %} section--padded{% endif %}{%if include.classes %} {{ include.classes }}{% endif %}{%if include.centred %} section--centred{% endif %}" style="{%if include.color %}color: {{ include.color }};{% endif %}{%if include.bgcolor %}background-color: {{ include.bgcolor }};{% endif %}">
<div class="l-container{%if include.size %} l-container--{{ include.size }}{% endif %}">
{% if include.title %}
<h3 class="h3">{{ include.title }}</h3>
{% endif%}
{{ include.body | markdownify }}
{% if include.link %}
<a href="{{ include.href }}" rel="external">{{ include.link }}</a>
{% endif %}
</div>
@mrmartineau
mrmartineau / front-matter.yml
Last active January 20, 2017 06:56
From my blog post: Creating dynamic layouts with Jekyll
# ------------ #
# Main content #
# ------------ #
partials:
- name: section-video
id: 183025668
spaced: true
- name: section
title: A wide-ranging audience. One unifying idea.
body: |
@mrmartineau
mrmartineau / for-loop.mustache
Last active January 20, 2017 06:00
From my blog post: Creating dynamic layouts with Jekyll
{% for item in page.partials %}
{% include {{item.name}}.html
spaced=item.spaced
padded=item.padded
src=item.src
title=item.title
body=item.body
link=item.link
href=item.href
gutter=item.gutter
@mrmartineau
mrmartineau / Colour-scheme.mustache
Last active January 20, 2017 05:53
Creating dynamic layouts with Jekyll
<style>
.hero {
background-color: {{ page.style.color.primary }};
color:{{ page.hero.color }};
background-image: url({{ site.assets.imgPath }}{{ page.hero.bg }}?w=500&{{ site.assets.params }});
}
.hero-title {
color: {{ page.hero.color }};
}