Skip to content

Instantly share code, notes, and snippets.

@MattiSG
MattiSG / upgrade-watai-05-06.sh
Last active December 22, 2015 10:59
Upgrade Watai from 0.5 to 0.6 syntax
#!/bin/bash
# Partially upgrades Watai tests from v0.5 syntax to v0.6
# Removes enclosing curly braces from Feature and Widget files
IFS=$(echo -en "\n\b")
for file in $(find -E "$1" -regex ".*(Feature|Widget)\.js$" -type f)
do
mv "$file" "$file~"
grep -v '^[{}]$' "$file~" | sed 's:^ ::g' > "$file"
<html>
<head>
<title>Async demo</title>
<style>
body {
width: 100%;
min-height: 8em;
border: 1px solid red;
}
</style>
@MattiSG
MattiSG / localize_helper.rb
Created October 14, 2013 12:02
Add number localization to Rails' `i18n` module.
module LocalizeHelper
# Wraps I18n.localize to add support for Numbers l12n.
#
# @param value [Numeric|DateTime|Time|Date] The value to localize.
# @return [String] The localized value.
# @see <https://github.com/svenfuchs/i18n/issues/135>
def localize(value)
if value.is_a?(Numeric)
number_with_delimiter(value, locale: I18n.locale)
@MattiSG
MattiSG / README.md
Last active February 5, 2016 15:47
ChromeDriver issue reproduction

With a running ChromeDriver:

git clone https://gist.github.com/4805526b5dcea0897c27.git
npm install selenium-webdriver
node index.js
@MattiSG
MattiSG / map.geojson
Last active November 3, 2016 15:08
All Internet Exchange Points listed on Wikipedia, mapped. Used in the State Surveillance map: http://mattischneider.fr/h4yr/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MattiSG
MattiSG / README.md
Last active November 3, 2016 16:07
How to get thumbnails on webpages

How to get thumbnails on pages

@MattiSG
MattiSG / ressource-types.js
Created April 24, 2017 10:54
Evaluate valid OpenFisca names from a list
var ressourceTypes = [
'aah',
'aeeh',
'af',
'aide_logement',
'allocationsChomage',
'allocationSecurisationPro',
'asf',
'asi',
'aspa',
@MattiSG
MattiSG / extract-formats.xsl
Created July 7, 2017 15:14
List XML attributes values
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="*">
<xsl:for-each select="@format">
<xsl:text>format: </xsl:text>
<xsl:value-of select="."/>
<xsl:text>
</xsl:text>
</xsl:for-each>
<xsl:for-each select="@type">
<xsl:text>type: </xsl:text>
@MattiSG
MattiSG / LICENSE.md
Last active November 24, 2017 14:37
Machine-readable map of human languages to countries they are spoken it, based on Wikipedia data

Source data is Wikipedia, so I think this stuff is CC-BY-SA. If any rights are attributed to me for formatting, I waive them all. The parser itself is under WTFPL.