Skip to content

Instantly share code, notes, and snippets.

View phayes's full-sized avatar
⌨️

Patrick Hayes phayes

⌨️
View GitHub Profile
@phayes
phayes / alphabets_and_scripts.json
Last active May 17, 2024 18:33
A JSON list of common alphabets and scripts and some of their properties
{
"Latn": {
"iso_code": "Latn",
"iso_number": 215,
"name": "Latin",
"unicode_ranges": ["U+0000–U+007F", "U+0080–U+00FF", "U+0100–U+017F", "U+0180–U+024F", "U+1E00–U+1EFF", "U+2C60–U+2C7F", "U+A720–U+A7FF"],
"languages": ["en", "fr", "de", "es", "pt", "it", "nl", "pl", "sv", "da", "no", "fi", "hu", "ro", "cs", "sk", "hr", "bs", "sl", "is"],
"direction": "ltr",
"casing": true,
"family": "Latin",
<?php
$url = "BCBT_Dec_2021.csv";
$csv = file_get_contents($url);
$csv = explode("\n", $csv);
$csv = array_filter($csv, "strlen");
$csv = array_map('str_getcsv', $csv);
$keys = array_shift($csv);
foreach ($csv as $i=>$row) {
@phayes
phayes / lang.json
Created March 24, 2022 15:36
Language Codes
{
"ab": {
"name": "Abkhaz",
"nativeName": "аҧсуа"
},
"aa": {
"name": "Afar",
"nativeName": "Afaraf"
},
"af": {
switch pub := cert.PublicKey.(type) {
case *rsa.PublicKey:
fmt.Println(pub.N)
case default:
fmt.Println("Error, not an RSA public key")
}
/**
* A timing safe equals comparison
*
* From: http://blog.ircmaxell.com/2012/12/seven-ways-to-screw-up-bcrypt.html
*
* To prevent leaking length information, it is important
* that user input is always used as the second parameter.
*
* @param string $safe The internal (safe) value to be checked
* @param string $user The user submitted (unsafe) value
HTTP/1.1 404 OK
Date: Tue, 28 Feb 2012 08:27:31 GMT
Server: Apache/2.2.14 (Unix) DAV/2 mod_jk/1.2.28 mod_ssl/2.2.14 OpenSSL/0.9.7a
X-Highwire-SessionId: HESGLsGsZ6gE@El5Ygdodg
X-Highwire-RequestId: T0yP86tDcSgAAGGWM7sAAAEm
Cache-Control: max-age=120
Set-Cookie: 07B79562CC23CD0F8BECF49A6604D0A8; Path=/
Connection: close; charset=ISO-8859-1
Content-Type: text/html
You look at trees and label them just so,
(for trees are 'trees', and growing is 'to grow');
you walk the earth and tread with solemn pace
one of the many minor globes of Space:
a star's a star, some matter in a ball
compelled to courses mathematical
amid the regimented, cold, inane,
where destined atoms are each moment slain.
At bidding of a Will, to which we bend
@phayes
phayes / Tab Seperated AIS countries
Last active December 22, 2015 20:59
This is a tab-separated lookup table for AIS country prefixes, giving both the country name and it's ISO 3166 code (for use with flag image packs). For more info see http://www.itu.int/online/mms/glad/cga_mids.sh?lng=E
201 Albania AL
202 Andorra AD
203 Austria AT
204 Azores - Portugal PT
205 Belgium BE
206 Belarus BY
207 Bulgaria BG
208 Vatican VA
209 Cyprus CY
210 Cyprus CY
impactStory.createAndGetCollection = function(aliases, title, callback, error, conf) {
impactStory.createCollection(aliases, title, function(collection) {
impactStory.getCollection(collection, callback, error, conf);
}, error);
});
<html>
<head>
<script type = "text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type = "text/javascript">
var success = function (data) {
console.log(data);
alert(data);
};
$.get("http://api.impactstory.org/tiid/doi/10.1371/journal.pcbi.1000361", function(data){console(data);});
</script>