This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convertMS(ms) { | |
var d, h, m, s; | |
s = Math.floor(ms / 1000); | |
m = Math.floor(s / 60); | |
s = s % 60; | |
h = Math.floor(m / 60); | |
m = m % 60; | |
d = Math.floor(h / 24); | |
h = h % 24; | |
return { d: d, h: h, m: m, s: s }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Enregistre l’émission Et cetera sur les ondes de Oui FM CKRH | |
# chaque vendredi soir à 20:00, heure d’Halifax. | |
# | |
# Executer regulièrement via cron : | |
# 59 7 * * 6 ckrhetcget.sh > /dev/null | |
set -e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/compression.rb | |
Rails.application.configure do | |
# Use environment names or environment variables: | |
# break unless Rails.env.production? | |
break unless ENV['ENABLE_COMPRESSION'] == '1' | |
# Strip all comments from JavaScript files, even copyright notices. | |
# By doing so, you are legally required to acknowledge | |
# the use of the software somewhere in your Web site or app: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use at your own risk. Will not work for all Japanese addresses. | |
const regex = /^(.+[都道府県])?(.+?[市郡区町村]+)([^0-90-9ー- -]*)([0-90-9]+[丁目番地のー--]*(?:[0-90-9]+[番ー--]?(?:[0-90-9]+号?)?)?)?[\s ー-~-]*(.*)?/ | |
const getMatch = (matches, index) => (matches ? matches[index] : null) || '' | |
const parseJpAddress = (str) => { | |
if (!str || !str.length) return {} | |
const matches = `${str}`.trim().match(regex) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env npx babel-node -- | |
// vim: ft=javascript | |
const readline = require('readline'); | |
const minimist = require('minimist'); | |
const { basename } = require('path'); | |
const errors = { | |
general: 1, | |
missingArg: 16, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Gemfile | |
gem 'kramdown' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For | |
* ES5 | |
* ES6 | |
* CoffeeScript |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# jsbookmarklet | |
# | |
# remi@remino.net | |
# 2018-04-19 | |
# | |
# Minify JavaScript file using uglify then save it to a file, | |
# output it to the screen, or copy the output to clipboard (macOS only), | |
# for usage as a browser bookmarklet. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This pre-commit hook checks that you havn't left and DONOTCOMMIT tokens in | |
# your code when you go to commit. | |
# | |
# To use this script copy it to .git/hooks/pre-commit and make it executable. | |
# | |
# This is provided just as an example of how to use a pre-commit hook to | |
# catch nasties in your code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Print date & time in JST time zone | |
# For Python 2.7.x without pytz module | |
import datetime | |
from datetime import datetime, timedelta, tzinfo | |
class JST(tzinfo): | |
def utcoffset(self, dt): | |
return timedelta(hours=9) |