Skip to content

Instantly share code, notes, and snippets.

View iheanyi's full-sized avatar
🪐
Working on databases @planetscale

Iheanyi Ekechukwu iheanyi

🪐
Working on databases @planetscale
View GitHub Profile
@kconner
kconner / macOS Internals.md
Last active September 23, 2024 15:19
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@awave1
awave1 / dl.fish
Last active September 22, 2020 02:41
function dl
set prev (pwd)
set songs "$HOME/Documents/Music/Songs"
cd $songs
youtube-dl -x --audio-format \"wav\" $argv
cd $prev
end
func CreatePDFFromHTML(inputHTML []byte) ([]byte, error) {
dirName, err := ioutil.TempDir("", "pdf-generator")
if err != nil {
return nil, err
}
// remove this and log the dirName if you need to debug the HTML
defer os.RemoveAll(dirName)
// log.Println(dirName)
@huylift
huylift / tachyons-to-tailwind-transform.js
Last active March 14, 2023 04:24 — forked from knoopx/tachyons-to-tailwind-transform.js
Transform tachyons classes to tailwind css (using babel-codemod)
// Installation:
// yarn add -D @codemod/cli @babel/plugin-syntax-jsx @babel/generator
import jsx from '@babel/plugin-syntax-jsx';
import generate from '@babel/generator';
const COLOR_MAP = {
'white': 'white',
'near-white': 'gray-100',
'light-gray': 'gray-200',
@typeoneerror
typeoneerror / notes.md
Last active July 18, 2018 20:17
Key-Value CSS validation concept

Iheanyi,

I realize your app may not be ruby-based, but here's how I've worked with this dilemma in mind in our app. To start, yes, we don't necessarily support custom CSS, but I do have a database field I (as admin) can add custom CSS to a customer's account template (in the case they have "premium support" or something). Our publicly customizable style settings are key:value based and stored as a JSON object in psql as you suggested might be an option. Here's how I make it less unweildy:

Field in the database:

t.json :settings
@barthr
barthr / action.go
Last active July 22, 2018 16:42
Wrapper for clean handlers in Go
package web
import (
"bytes"
"encoding/json"
"io"
"net/http"
)
type errorResponse struct {
@SpainTrain
SpainTrain / config_model.py
Created June 12, 2017 17:19
Store Config for Google App Engine Python App in Datastore (https://12factor.net/config)
from os import environ
from google.appengine.ext import ndb
from google.appengine.ext.ndb import model
from pydash import snake_case
class Config(ndb.Model):
value = ndb.StringProperty()
value_previous = ndb.StringProperty()
@przbadu
przbadu / Ctags.md
Last active September 10, 2024 18:08
Ctags for ruby on rails and node applications

Install ctags

http://ctags.sourceforge.net follow this url for installation and documentation.

Ctags with Ruby/Rails

We can ctags lots of programming languages. Here is how to do it for ruby/rails. I really like how RubyMine jumps to the source code (either withing project score or to the gem source). This is really useful for reading source code for those classes, methods, modules etc. But Now that I use vim as My IDE/Editor I really like that functionality to happen in my vim editor. And I found ctags as the solution.

@davidpett
davidpett / app.css
Created January 21, 2017 21:22
using tachyons in ember.js
@import './tachyons/tachyons'; // tachyons source
@import './_custom'; // any custom css
@import './_vars'; // put last because that is how CSS vars work...
/*
in _vars.css you can override tachyons vars
:root {
--navy: #001624;
function formToData(form) {
const formData = new FormData(form.get()[0])
var params = new Map()
var errors = []
var inputElements = {}
// Initially iterate through all the inputs
form.find(':input').each(function(key, value) {
var elem = $(this)
var name = elem.attr('name')