Skip to content

Instantly share code, notes, and snippets.

View PeteDevoy's full-sized avatar

Pete PeteDevoy

View GitHub Profile
@PeteDevoy
PeteDevoy / select-multiple-example-2021.elm
Created December 16, 2021 08:47
Select Multiple example for Elm language
{- authored by https://github.com/lucamug -}
module Main exposing (main)
import Browser
import Html exposing (..)
import Html.Attributes
import Html.Events
import Json.Decode
@PeteDevoy
PeteDevoy / make-the-text-for-all-links-the-url-of-the-link.js
Created October 6, 2020 15:15
Make the text for all links the URL of the link.
@PeteDevoy
PeteDevoy / erlang_gen_tcp_null_byte_delimited.erl
Created October 19, 2019 12:58
Erlang gen_tcp {packet, line} with null byte line delimiter
%Open two shells
%In first shell
{ok, ListenSock} = gen_tcp:listen(8091, [{active,true}, binary]).
{ok, AcceptSock} = gen_tcp:accept(ListenSock).
%it waits, so proceed to connect in second shell:
%In second shell
{ok, ClientSock} = gen_tcp:connect({127,0,0,1}, 8091, [binary, {active, true}]).
@PeteDevoy
PeteDevoy / 1_phpunit-api.md
Created October 7, 2018 11:39 — forked from loonies/1_phpunit-api.md
PHPUnit Cheat Sheet

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this->anything()
@PeteDevoy
PeteDevoy / wakatime-project-dates-worked.js
Created May 21, 2018 14:17
Show seconds worked on which days from WakaTime JSON
//for chrome/chromium browser (verified working May 2018)
/*
Shows a table of which dates WakaTime tracked work on a project and
how many seconds were tracked on that date. How to use:
disable any json formatting extensions
use dev tools to view network requests
open project page in WakaTime
open AJAX request in new tab
@PeteDevoy
PeteDevoy / find-largest-field-value-in-groups-of-size-n.sql
Created April 29, 2018 14:45
PostgreSQL: find largest field value in groups of size n
--create example data (20 rows)
CREATE TABLE employees (employee_id integer PRIMARY KEY, name text);
INSERT INTO employees
VALUES
(1, 'Zachary Ashley'),
(5, 'Oliver Zuniga'),
(17, 'Ashley Carney'),
(19, 'Callie Singh'),
(23, 'Yamilet Barrett'),
(31, 'Jamir Stanton'),
@PeteDevoy
PeteDevoy / photoshop-chequerboard.css
Created February 27, 2018 12:30
Photoshop-style Chequerboard Background CSS
/* with 0 margin, 0 padding and sans-serif */
body {
margin:0;
padding:0;
background-image:
-webkit-gradient(linear, 0 100%, 100% 0, color-stop(.25, #eee), color-stop(.25, transparent)),
-webkit-gradient(linear, 0 0, 100% 100%, color-stop(.25, #eee), color-stop(.25, transparent)),
-webkit-gradient(linear, 0 100%, 100% 0, color-stop(.75, transparent), color-stop(.75, #eee)),
-webkit-gradient(linear, 0 0, 100% 100%, color-stop(.75, transparent), color-stop(.75, #eee));
background-size:10px 10px;