Skip to content

Instantly share code, notes, and snippets.

@sandren
sandren / tailwind.md
Last active February 28, 2025 13:05
Tailwind CSS best practices

Tailwind CSS best practices

Utility classes

  1. When writing a string of multiple utility classes, always do so in an order with meaning. The "Concentric CSS" approach works well with utility classes (i.e,. 1. positioning/visibility 2. box model 3. borders 4. backgrounds 5. typography 6. other visual adjustments). Once you establish a familiar pattern of ordering, parsing through long strings of utility classes will become much, much faster so a little more effort up front goes a long way!

  2. Always use fewer utility classes when possible. For example, use mx-2 instead of ml-2 mr-2 and don't be afraid to use the simpler p-4 lg:pt-8 instead of the longer, more complicated pt-4 lg:pt-8 pr-4 pb-4 pl-4.

  3. Prefix all utility classes that will only apply at a certain breakpoint with that breakpoint's prefix. For example, use block lg:flex lg:flex-col lg:justify-center instead of block lg:flex flex-col justify-center to make it very clear that the flexbox utilities are only applicable at the

@tatianamac
tatianamac / tatiana-mac-speaker-rider.md
Last active January 17, 2025 12:50
Tatiana Mac's Speaker Rider

Speaker Rider

by Tatiana Mac

Last updated 14 April 2021

What is a speaker rider?

As speaking comes with immense privilege, I have crafted a speaker rider to set expectations and boundaries around my engagement. I am grateful to all the conference organisers who have brilliantly hosted me. I would love to continue to exercise this privilege to speak at conferences, and use this privilege to make the landscape more accessible and beneficial to tech's most historically excluded and marginalised communities.

Considerations

😫 I provide a lot of explanations for those of you who never had to consider these things. Most thoughtful conferences I've attended check most of these boxes intrinsically, particularly when conference runners are experienced speakers. They get it.

@hopsoft
hopsoft / install-ruby.sh
Created May 21, 2019 16:13
Install ruby with rbenv and jemalloc on ubuntu
sudo apt-get update
sudo apt-get install libjemalloc-dev
RUBY_CONFIGURE_OPTS='--with-jemalloc' rbenv install 2.6.3
# test (look for jemalloc warnings)
MALLOC_CONF=invalid_flag:foo ruby -v
function replaceAll(str, find, replace) {
return str.replace(new RegExp(find, 'g'), replace);
}
function dec2hex(dec, padding){
return parseInt(dec, 10).toString(16).padStart(padding, '0');
}
function utf8StringToUtf16String(str) {
var utf16 = [];
# GLiNet MT300N-V2 安装 SSR plus 插件
GLiNet 是一家 生产 便携路由的国内厂商 好像外销为主。
最主要的是他家 路由系统采用的是开源 OpenWrt 系统 并在github 上开源 并提供sdk 和 很多插件
但是国内政策的关系 国内买到的路由器固件内 并没有提供直接安装 SS SSR V2ray 的方法。
经过在 恩三论坛 学习了下(www.right.com.cn) 已经成功把lean 开源的(https://github.com/coolsnowwolf/lede.git) SSR plus 插件 成功的安装到了 MT300N-V2 固件中,下面记录一些安装步骤。
@ruanyf
ruanyf / mtr.css
Created March 16, 2019 11:23
mtr.css: Hong Kong MTR station colors http://metrocolor.live/index.html
:root {
--heng-fa-chuen: #b51921;
--tai-koo: #b2103e;
--kowloon-bay: #c41832;
--tseung-kwan-o: #ef342a;
--wui-kai-sha: #a84d18;
--po-lam: #f68f26;
--sai-wan-ho: #faca07;
--disneyland-resort: #07594a;
--skek-kip-mei: #4ba946;
@cantino
cantino / base64-md5-test.rb
Created February 28, 2019 23:41
Four ways to compute the base64 md5 checksum used by ActiveStorage
require 'digest'
# From activestorage
def compute_checksum_in_chunks(io)
Digest::MD5.new.tap do |checksum|
while chunk = io.read(5242880)
checksum << chunk
end
io.rewind
end.base64digest
@joshuacerbito
joshuacerbito / useScroll.js
Last active January 8, 2024 13:44
Custom React hook for listening to scroll events
/**
* useScroll React custom hook
* Usage:
* const { scrollX, scrollY, scrollDirection } = useScroll();
*/
import { useState, useEffect } from "react";
export function useScroll() {
const [lastScrollTop, setLastScrollTop] = useState(0);
@douglasmiranda
douglasmiranda / ansible.md
Last active November 1, 2024 20:40
Ansible: Notes, Errors and Solutions

Ansible for Configuration Management

I'm using Ansible only for Configuration Management, the server is up and I want to configure users, install packages and configure them.

For infrastructure provisioning terraform.io is nice!

Currently, my deployment flow includes Drone.io/GitlabCI for CI/CD and Docker Swarm for orchestrating containers.

@cswalina
cswalina / gist:5f04c41dfc4eb017e8ed5ec340e30557
Created June 14, 2018 21:27
Rails API 2 ways: active_model_serializers, fast_jsonapi
gem 'active_model_serializers'
rails g serializer publication
app/serializers/api/v1/publication_serializer.rb
module API::V1
class PublicationSerializer < ActiveModel::Serializer
attributes :title
end