Skip to content

Instantly share code, notes, and snippets.

View DirtyF's full-sized avatar
😷
Home

Frank Taillandier DirtyF

😷
Home
View GitHub Profile
@yannmadeleine
yannmadeleine / gist:1082570
Created July 14, 2011 14:34
calculate cost and time for a travel in car via highway in france
from selenium import webdriver
from selenium import selenium
from webdriver import DesiredCapabilities
import re
to_cities = ['toulouse', 'bordeaux', 'marseille']
from_cities = [
'paris',
'toulouse',
'bordeaux',
@MoOx
MoOx / README.md
Created June 16, 2012 21:43
French translation for necolas/idiomatic-css

Principes d'écriture de CSS consistent et idiomatique

Le présent document liste des recommandations raisonnables pour développer avec CSS.

Il n'est pas destiné à être normatif et je ne souhaite pas imposer mes préférences de style de code aux gens. Toutefois, ces lignes directrices encouragent fortement le fait d'utiliser des modèles existants, communs et sensés.

Ceci est un document évolutif et les nouvelles idées sont toujours les bienvenues. Merci de contribuer.

@brunobord
brunobord / kill.js
Created January 30, 2013 23:21
Casper Script: restart Alwaysdata processes.
/**
* Casper script to restart Alwaysdata processes.
*
* Usage:
* $ casperjs kill.js email@example.com mysecretpassword
*/
var casper = require('casper').create();
casper.start("https://admin.alwaysdata.com/login/");
@shinypb
shinypb / gist:4485878
Created January 8, 2013 17:32
Bookmarklet to reload CSS without reloading the entire page
(function(){
$('link[rel="stylesheet"]').each(function(i, elem) {
// Make an anchor tag with the stylesheet's href -- this is a weird/handy way of
// working with URLs in the browser.
var anchorTag = $('a').attr('href', elem.getAttribute('href'))[0];
// Rewrite the URL to have a cache busting parameter. This assumes
// that any query params weren't significant.
anchorTag.search = "ts=" + (+new Date);
@chrisdmacrae
chrisdmacrae / README.md
Last active January 30, 2018 21:45
Algolia Search - Forestry.io

Simple Algolia w/ Hugo

The following allows you to easily generate an Algolia index with Hugo consisting of whatever front matter metadata you like.

Why this compared to other plugins?

There are plugins that generate indexes using NPM packages or other tools. The issue is that they don't have any context to your site configuration or Hugo's internals, so they may miss pages or index pages that should not be indexed.

Using Hugo means your index has the full context of your site available when being generated.

Generating Index

To generate the index you create the index's layout at layouts/_default/list.algolia.json.

@budparr
budparr / csplit.txt
Last active September 28, 2018 08:56
Terminal command to split a list of markdown items into separate documents. Given a "slug" value, the file will be named that. You could also change slug to title and create slugs/filenames from the title. You may also want to run your output through a markdown converter, like https://github.com/domchristie/to-markdown
csplit -k -n 3 export.txt '/^@@@/' {'999'}; for i in xx*; do sed -i '' 's/@@@/---/g' $i; done; for i in xx*; do mv $i `egrep -m1 -e 'slug:.*' $i | sed -e s/[^\]\[A-Za-z0-9~.,_{}\(\)\'\-\+]/-/g -e s/slug--//`.md; done
@budparr
budparr / hugo-search-index.json
Created October 16, 2018 14:21
#gohugo search index with "some" stop words removed
{{- $.Scratch.Add "index" slice -}}
{{$index := where .Site.RegularPages ".Section" "not in" (slice "links" "internal") }}
{{- range $index -}}
{{ with .Params.images }}
{{ $.Scratch.Set "image" (index . 0)}}
{{ else }}
{{ $.Scratch.Set "image" "/uploads/logo.jpg"}}
{{ end }}
{{ $image := printf "%s%s" (replace ($.Scratch.Get "image") "/uploads" .Site.Params.image_url) "?fit=crop&h=201&w=358" }}
{{- $content_filtered := replaceRE "(?m)(?i)(?s:\\ba\\b|\\band\\b|\\barchival\\b|\\bagain\\b|\\bin\\b|\\bto\\b|\\bis\\b|\\bno\\b|\\bor\\b|\\bthis\\b|\\bwell\\b|\\byes\\b|\\bthe\\b|\\bthere\\b|\\bthese\\b|\\bthen\\b)" "" (delimit .PlainWords " ") -}}
@Andy-set-studio
Andy-set-studio / example.md
Created December 15, 2018 14:35
Filter posts by a passed year
title An example
year 2018
layout example.njk
@budparr
budparr / robots.txt
Last active August 13, 2019 14:21
Jekyll Robots page to exclude from robots pages that are excluded from the sitemap
---
layout: null
permalink: robots.txt
---
# filter pages and documents for the noindex key
{% assign noindexPages = site.pages | where: 'sitemap', false %}
{% assign noindexDocuments = site.documents | where: 'sitemap', false %}
User-agent: *
# robotstxt.org - if _config production variable is false robots will be disallowed.
{% if site.production != true %}
@SirRawlins
SirRawlins / Rakefile
Last active September 15, 2020 06:22
Using Jekyll plugins on GitHub Pages.
# Rquire jekyll to compile the site.
require "jekyll"
# Github pages publishing.
namespace :blog do
#
# Because we are using 3rd party plugins for jekyll to manage the asset pipeline
# and suchlike we are unable to just branch the code, we have to process the site
# localy before pushing it to the branch to publish.
#