Skip to content

Instantly share code, notes, and snippets.

View morajabi's full-sized avatar
🦀

Mo morajabi

🦀
View GitHub Profile
class TimeElapsed: CustomStringConvertible {
private let startTime: CFAbsoluteTime
private var endTime: CFAbsoluteTime?
init() {
startTime = CFAbsoluteTimeGetCurrent()
}
var description: String {
time
@bdsqqq
bdsqqq / vesper-dark.json
Last active May 16, 2024 00:57
Vesper theme for zed.dev
{
"$schema": "https://zed.dev/schema/themes/v0.1.0.json",
"name": "Vesper",
"author": "Rauno Freiberg",
"themes": [
{
"name": "Vesper",
"appearance": "dark",
"style": {
"border": "#101010",
@alii
alii / ensure-keys.ts
Created August 25, 2021 14:12
Infer object values while strictly specifying keys in TypeScript
/**
* TypeScript currently lacks a way of typing a record of keys only but not values.
* we need this because we want an object of typed keys but we want to leave the values inferred.
* thankfully, we can do this with generics. This function allows the second generic's values to be inferred
* so that our object is fully type safe for hugely complex types, but we can guarantee that all the keys we need exist.
* It's not perfect, but it gets the job done for the time being
*/
export function ensureKeys<T>() {
/**
* Function that returns the value that gets put in, values are type-safely inferred
@surpher
surpher / rust_to_swift.md
Last active April 25, 2024 12:30
Building binaries from Rust to iOS/macOS (PactSwift specific)
@nickffox
nickffox / Keyboard.swift
Created August 16, 2019 18:43
Adjusting a SwiftUI View for the Keyboard.
import Combine
final class Keyboard: ObservableObject {
// MARK: - Published Properties
@Published var state: Keyboard.State = .default
// MARK: - Private Properties
@timothycosta
timothycosta / UIScrollViewWrapper.swift
Created July 5, 2019 03:25
UIScrollView wrapped for SwiftUI
//
// UIScrollViewWrapper.swift
// lingq-5
//
// Created by Timothy Costa on 2019/07/05.
// Copyright © 2019 timothycosta.com. All rights reserved.
//
import SwiftUI
@jarrodthibodeau
jarrodthibodeau / now.json
Created May 2, 2019 21:46
now.json 2.0 static configuration to get your grade on securityheaders.com to an A (only for root path)
{
"version": 2,
"name": "PROJECT_NAME_HERE",
"alias": [
"YOUR_ALIASES_HERE"
],
"routes": [
{
"src": "/",
"headers": {
@WesSouza
WesSouza / zeit-now-g-suite-setup.md
Last active March 27, 2019 18:23 — forked from jaydenseric/zeit-now-g-suite-setup.md
Zeit Now G Suite setup

Run each of the following lines, replacing yourdomain.com and AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA with your details:

export NOW_DOMAIN=yourdomain.com
export GOOGLE_VERIFICATION=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
now dns add "$NOW_DOMAIN" @ TXT "google-site-verification=$GOOGLE_VERIFICATION"
now dns add "$NOW_DOMAIN" @ MX ASPMX.L.GOOGLE.COM 1
now dns add "$NOW_DOMAIN" @ MX ALT1.ASPMX.L.GOOGLE.COM 5
now dns add "$NOW_DOMAIN" @ MX ALT2.ASPMX.L.GOOGLE.COM 5
now dns add "$NOW_DOMAIN" @ MX ALT3.ASPMX.L.GOOGLE.COM 10
@threepointone
threepointone / for-snook.md
Last active August 26, 2023 15:43
For Snook

https://twitter.com/snookca/status/1073299331262889984?s=21

‪“‬In what way is JS any more maintainable than CSS? How does writing CSS in JS make it any more maintainable?”

‪Happy to chat about this. There’s an obvious disclaimer that there’s a cost to css-in-js solutions, but that cost is paid specifically for the benefits it brings; as such it’s useful for some usecases, and not meant as a replacement for all workflows. ‬

‪(These conversations always get heated on twitter, so please believe that I’m here to converse, not to convince. In return, I promise to listen to you too and change my opinions; I’ve had mad respect for you for years and would consider your feedback a gift. Also, some of the stuff I’m writing might seem obvious to you; I’m not trying to tell you if all people of some of the details, but it might be useful to someone else who bumps into this who doesn’t have context)‬

So the big deal about css-in-js (cij) is selectors.

@arashmilani
arashmilani / twitter-activity-tweets-remover.js
Last active May 26, 2019 11:06
Twitter "activity tweets" remover
// ==UserScript==
// @name twitter-activity-tweets-remover
// @namespace http://arashmilani.com/
// @version 0.1
// @description Twitter "activity tweets" remover
// @author Arash Milani
// @match https://*twitter.com/*
// @grant none
// ==/UserScript==