Skip to content

Instantly share code, notes, and snippets.

View ejamesc's full-sized avatar

Cedric Chin ejamesc

View GitHub Profile

this is what i use so far, its obviously not a 100% replica of the typography plugin but looks good enough on my site

  /* replace typography plugin */
  .prose {
    @apply text-gray-700 dark:text-gray-300
  }
  .prose {
    & p {
@cmod
cmod / hugofastsearch.md
Last active May 1, 2024 05:20 — forked from eddiewebb/readme.md
Fast, instant client side search for Hugo static site generator

Super fast, keyboard-optimized, client side Hugo search

This is a fork of and builds upon the work of Eddie Webb's search and Matthew Daly's search explorations.

It's built for the Hugo static site generator, but could be adopted to function with any json index compatible with Fuse fuzzy search library.

To see it in action, go to craigmod.com and press CMD-/ and start typing.

Fast Search

@kilbot
kilbot / watermelon.d.ts
Created March 2, 2019 04:16
TypeScript declaration file for WatermelonDB
declare module '@nozbe/watermelondb' {
import * as Q from '@nozbe/watermelondb/QueryDescription'
export { default as Collection } from '@nozbe/watermelondb/Collection'
export { default as Database } from '@nozbe/watermelondb/Database'
export { default as CollectionMap } from '@nozbe/watermelondb/Database/CollectionMap'
export { default as Relation } from '@nozbe/watermelondb/Relation'
export { default as Model, associations } from '@nozbe/watermelondb/Model'
export { default as Query } from '@nozbe/watermelondb/Query'
export { tableName, columnName, appSchema, tableSchema } from '@nozbe/watermelondb/Schema'
@sma
sma / example.dart
Last active July 12, 2023 03:00
A flutter example demonstrating a custom painter drawing selectable rects
// run in DartPad: <https://dartpad.dev/c6a9111d58c3deb83711106cec6152ee>
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(home: RectsExample()));
}
class RectsExample extends StatefulWidget {
@override
@subfuzion
subfuzion / dep.md
Last active June 14, 2023 15:46
Concise guide to golang/dep

Overview

This gist is based on the information available at golang/dep, only slightly more terse and annotated with a few notes and links primarily for my own personal benefit. It's public in case this information is helpful to anyone else as well.

I initially advocated Glide for my team and then, more recently, vndr. I've also taken the approach of exerting direct control over what goes into vendor/ in my Dockerfiles, and also work from isolated GOPATH environments on my system per project to ensure that dependencies are explicitly found under vendor/.

At the end of the day, vendoring (and committing vendor/) is about being in control of your dependencies and being able to achieve reproducible builds. While you can achieve this manually, things that are nice to have in a vendoring tool include:

@iampeter
iampeter / tags.md
Last active December 13, 2019 07:37
Implementing tagging in Golang with Postgres JSONB type and SQLX

When you need to handle text tags in Golang, eg. a Document can be tagged with software engineering, important and golang, you could do it with the Postgres text[] array type.

But with the jsonb type, you have all the marshalling and unmarshalling already there, so all you need to do is have a []string type, like below:

type JSONTags []string

func (tags *JSONTags) Scan(src interface{}) error {
#!/bin/bash
STRING=$(< /dev/stdin)
KEY=
CHAT_ID=
curl -G -i -X GET \
"https://api.telegram.org/bot$KEY/sendMessage?chat_id=$CHAT_ID&parse_mode=Markdown" \
--data-urlencode 'text=`'"$STRING"'`'
alias glp="git log --color -p | less -R"
alias glg="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit | less -R"
alias hlog='git log --date-order --all --graph --format="%C(green)%h %Creset%C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset %s"'
alias cdg="cd \$(git rev-parse --show-toplevel)"
@non
non / answer.md
Last active January 9, 2024 22:06
answer @nuttycom

What is the appeal of dynamically-typed languages?

Kris Nuttycombe asks:

I genuinely wish I understood the appeal of unityped languages better. Can someone who really knows both well-typed and unityped explain?

I think the terms well-typed and unityped are a bit of question-begging here (you might as well say good-typed versus bad-typed), so instead I will say statically-typed and dynamically-typed.

I'm going to approach this article using Scala to stand-in for static typing and Python for dynamic typing. I feel like I am credibly proficient both languages: I don't currently write a lot of Python, but I still have affection for the language, and have probably written hundreds of thousands of lines of Python code over the years.

@paulirish
paulirish / bling.js
Last active May 1, 2024 19:56
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;