Skip to content

Instantly share code, notes, and snippets.

View razzius's full-sized avatar
🍉

Razzi Abuissa razzius

🍉
View GitHub Profile
@tommyip
tommyip / venv.fish
Last active February 23, 2024 20:00
venv.fish - Automatically activate/deactivate virtualenv in fish shell
# Based on https://gist.github.com/bastibe/c0950e463ffdfdfada7adf149ae77c6f
# Changes:
# * Instead of overriding cd, we detect directory change. This allows the script to work
# for other means of cd, such as z.
# * Update syntax to work with new versions of fish.
# * Handle virtualenvs that are not located in the root of a git directory.
function __auto_source_venv --on-variable PWD --description "Activate/Deactivate virtualenv on directory change"
status --is-command-substitution; and return
@chapmanjacobd
chapmanjacobd / functions.fish
Last active August 8, 2020 10:35
fish functions
function sponge
/usr/bin/mkdir -p (dirname "$argv")
/usr/bin/sponge "$argv"
end
function tee
/usr/bin/mkdir -p (dirname "$argv")
/usr/bin/tee "$argv"
end
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active May 15, 2024 20:11
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@augustocdias
augustocdias / README.md
Last active September 17, 2019 21:40
Port forward Mac OS

Port Forwarding on Mac OS

In order to use the 80 or 443 ports on Mac OS without the need to start web server with root:

echo "rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080" | sudo pfctl -ef -

echo "rdr pass inet proto tcp from any to any port 443 -> 127.0.0.1 port 8443" | sudo pfctl -ef -

@brianlovin
brianlovin / index.js
Last active October 29, 2019 20:04
Flow type function prop
// component
type AnotherType = {
data: {
id: string
}
}
type Props = {
aFunction: ({ id: string }) => AnotherType
}
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<link href="https://fonts.googleapis.com/css?family=Stint+Ultra+Expanded" rel="stylesheet">
</head>
<body>
<p>Guess between: 1-15</p>
<input id= "one"><button id="first">Submit</button>
<div class="sup">You Guessed:</div><div id="word"></div>
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<input><button>Submit</button>
<div>You guessed:</div><div id="word"></div>
<div id="WL"></div>
<div id="img"></div>
@zcmarine
zcmarine / remap_capslock.lua
Created March 28, 2017 15:35
Hammerspoon capslock remapping: tap to Escape, hold in chord for Control
-- Inspired by https://github.com/jasoncodes/dotfiles/blob/master/hammerspoon/control_escape.lua
-- You'll also have to install Karabiner Elements and map caps_lock to left_control there
len = function(t)
local length = 0
for k, v in pairs(t) do
length = length + 1
end
return length
end
@RichardBronosky
RichardBronosky / README.MD
Last active May 19, 2024 22:03
cb - A leak-proof tee to the clipboard - Unify the copy and paste commands into one intelligent chainable command.

cb

A leak-proof tee to the clipboard

This script is modeled after tee (see [man tee][2]) and works on Linux, macOS, Cygwin, WSL/WSL2

It's like your normal copy and paste commands, but unified and able to sense when you want it to be chainable.

This project started as an answer to the StackOverflow question: [How can I copy the output of a command directly into my clipboard?][3]

@codeboost
codeboost / server.cljs
Created November 10, 2016 10:02
Clojurescript sample node http server
(ns helloserver
(:require [cljs.nodejs :as nodejs]))
(def http (nodejs/require "http"))
(-> (.createServer http (fn [req res]
(doto res
(.writeHead 200 {"Content-Type" "text/plain"})
(.end "Hello from ClojureScript"))))
(.listen 8080 "127.0.0.1"))