Skip to content

Instantly share code, notes, and snippets.

View calvinclaus's full-sized avatar

Calvin Claus calvinclaus

  • Motion Group
View GitHub Profile
@spolischook
spolischook / kotoblog_parse-http-accept-language-header.php
Last active November 15, 2023 04:35
Get prefer language by parsing HTTP_ACCEPT_LANGUAGE header
<?php
$prefLocales = array_reduce(
explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']),
function ($res, $el) {
list($l, $q) = array_merge(explode(';q=', $el), [1]);
$res[$l] = (float) $q;
return $res;
}, []);
arsort($prefLocales);
@wintersolutions
wintersolutions / gist:377b413424444ec61133
Created December 10, 2014 09:20
Devise 3.1, 3.2 German Translation
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
de:
devise:
confirmations:
confirmed: "Vielen Dank für Ihre Registrierung. Bitte melden Sie sich jetzt an."
confirmed_and_signed_in: "Vielen Dank für Ihre Registrierung. Sie sind jetzt angemeldet."
send_instructions: "Sie erhalten in wenigen Minuten eine E-Mail, mit der Sie Ihre Registrierung bestätigen können."
send_paranoid_instructions: "Falls Ihre E-Mail-Adresse in unserer Datenbank existiert erhalten Sie in wenigen Minuten eine E-Mail mit der Sie Ihre Registrierung bestätigen können."
failure:
@Integralist
Integralist / Ruby Lambdas.md
Last active August 8, 2023 05:10
Ruby lambdas

Lambda: standard

# Creating a lambda
l = lambda { |name| "Hi #{name}!" }

# Executing the lambda
l.call("foo") # => Hi foo!