Skip to content

Instantly share code, notes, and snippets.

View cmnstmntmn's full-sized avatar

Constantin Angheloiu cmnstmntmn

View GitHub Profile
@mxgrn
mxgrn / lv_modal_close_confirm.md
Last active January 1, 2024 03:57
LiveView modal close confirmation on dirty form
@fvilante
fvilante / Meiosis.ts
Last active July 8, 2021 09:54
Meiosis pattern in typescript (a simple example)
// uses 'flyd' stream micro-library
type Stream = (_: number) => Stream // this life is a simplification
interface Model {
value: number
}
interface Actions {
increment: () => void
@animaux
animaux / data.next_month.php
Created February 19, 2019 21:24
Symphony CMS Custom Datasource. Displays next month as param in the param pool.
<?php
require_once(TOOLKIT . '/class.datasource.php');
class datasourcenext_month extends Datasource{
function about(){
return array(
'name' => 'Next Month',
'author' => array(
@evancz
evancz / cron.md
Last active December 25, 2020 13:18
Cron job to remind myself to stretch

Type crontab -l to see your cron jobs. Type crontab -e to edit them. You have to use Vim apparently.

Add a line like this:

0,30	*	*	*	*	/Users/YOURNAME/Documents/scripts/stretch.sh

That is on every 0th and 30th minute of the hour. Make sure all the separators in there are tabs!

@orbitbot
orbitbot / http.js
Last active May 26, 2017 21:17
Ergonomic Mithril.js 1.x requests
// GET, POST, PUT, PATCH, DELETE, HEAD or OPTIONS
// data becomes querystring on GET requests
class Http {
constructor() {
let methods = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options']
methods.forEach((method) => {
this[method] = (url, data, opts) => m.request(Object.assign({ method, url, data }, opts, this.eval(), this.defaults))
})
}
@webcss
webcss / mithril-touch.js
Last active May 26, 2020 15:34
mithril-touch, consume touch and mouse events evenly with mithril
/*****************************************
/* DOM touch support module
/*****************************************/
if (!window.CustomEvent) {
window.CustomEvent = function (event, params) {
params = params || { bubbles: false, cancelable: false, detail: undefined };
var evt = document.createEvent('CustomEvent');
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
return evt;
};