Skip to content

Instantly share code, notes, and snippets.

@postspectacular
postspectacular / theme-swatches.ts
Last active July 10, 2023 10:57
Marblemania color theme swatch generator (context: https://mastodon.thi.ng/@toxi/110689378884928332)
import { sortByCachedKey } from "@thi.ng/arrays";
import { analog, lch, srgb, swatchesH } from "@thi.ng/color";
import { asRGB, type LCHTheme, type RGBTheme } from "@thi.ng/color-palettes";
import { compareNumAsc } from "@thi.ng/compare";
import { serialize } from "@thi.ng/hiccup";
import { svg } from "@thi.ng/hiccup-svg";
import { SYSTEM } from "@thi.ng/random";
import { map, mean, pluck, range } from "@thi.ng/transducers";
import { comparator3 } from "@thi.ng/vectors";
import { writeFileSync } from "fs";

PostSpectacular Manifesto

Literacy

  • Learn by doing
    • Take away a sound understanding of new concepts learned at the end of each activity
    • Transform knowledge into intuition
    • Share your learnings
    • Experiment to avoid/overcome procrastination
  • Go further, Carpe noctem
@pavankjadda
pavankjadda / How to fix gitignore not working issue.md
Last active April 10, 2024 15:47
How to fix "gitignore not working" issue

FYI: Created blog post with more details

How to fix ".gitignore not working" issue?

Sometimes git does not exclude files/folders added .gitignore especially if you had commited them before. Here is how to fix it. I am ignoring node_modules from Angular project as an example

  1. Update .gitignore with the folder/file name you want to ignore. You can use anyone of the formats mentioned below (prefer format1)
### Format1  ###
node_modules/
@JonnyNineToes
JonnyNineToes / PHP Title Case
Last active June 28, 2023 07:48
PHP Title Case function
function titleCase($string) {
//reference http://grammar.about.com/od/tz/g/Title-Case.htm
// The below array contains the most commonly non-capitalized words in title casing - I'm not so sure about the commented ones that follow it...
$minorWords = array('a','an','and','as','at','but','by','for','in','nor','of','on','or','per','the','to','with'); // but, is, if, then, else, when, from, off, out, over, into,
// take the input string, trim whitespace from the ends, single out all repeating whitespace
$string = preg_replace('/[ ]+/', ' ', trim($string));
// explode string into array of words
$pieces = explode(' ', $string);
// for each element in array...
for($p = 0; $p <= (count($pieces) - 1); $p++){