Skip to content

Instantly share code, notes, and snippets.

View cor's full-sized avatar
❄️
Nix

cor cor

❄️
Nix
View GitHub Profile
@quad
quad / 0-modular-errors-with-rusts-thiserror.md
Last active April 13, 2024 14:07
Modular Errors with Rust's thiserror

I've been writing Rust full-time with a small team for over a year now. Throughout, I've lamented the lack of clear best practices around defining error types. One day, I'd love to write up my journey and enumerate the various strategies I've both seen and tried. Today is not that day.

Today, I want to reply to a blog post that almost perfectly summarised my current practice.

Go read it; I'll wait!


@mitchellh
mitchellh / overlay.nix
Last active December 5, 2023 05:38
Playdate SDK on Nix on aarch64
let
# Playdate distributes their SDK as precompiled x86_64 binaries
# currently so we have to import cross-compiled packages for it
# if we're not on an x86_64 system.
pkgsIntel = import <nixpkgs> {
crossSystem = {
config = "x86_64-unknown-linux-gnu";
};
};
in
@jmatsushita
jmatsushita / README
Last active March 26, 2024 10:57
Setup nix, nix-darwin and home-manager from scratch on an M1 Macbook Pro
###
### [2023-06-19] UPDATE: Just tried to use my instructions again on a fresh install and it failed in a number of places.
###. Not sure if I'll update this gist (though I realise it seems to still have some traffic), but here's a list of
###. things to watch out for:
### - Check out the `nix-darwin` instructions, as they have changed.
### - There's a home manager gotcha https://github.com/nix-community/home-manager/issues/4026
###
# I found some good resources but they seem to do a bit too much (maybe from a time when there were more bugs).
# So here's a minimal Gist which worked for me as an install on a new M1 Pro.
@bpesquet
bpesquet / .gitattributes-lfs-unity
Last active December 7, 2022 22:37
.gitattributes file for LFS with Unity
* text=auto
# Unity files
*.meta -text -merge=unityamlmerge
*.unity -text -merge=unityamlmerge
*.asset -text -merge=unityamlmerge
*.prefab -text -merge=unityamlmerge
# Image formats
*.psd filter=lfs diff=lfs merge=lfs -text
@GeorgeGkas
GeorgeGkas / index.js
Created July 29, 2018 09:43
Deep copy/clone a class instance in Javascript
/**
* @function
* @description Deep clone a class instance.
* @param {object} instance The class instance you want to clone.
* @returns {object} A new cloned instance.
*/
function clone(instance) {
return Object.assign(
Object.create(
// Set the prototype of the new object to the prototype of the instance.
@mburakerman
mburakerman / package.json
Last active September 26, 2022 17:32
Webpack 4 config.js (SCSS to CSS and Babel) 👌 The Simplest Usage 👌
{
"name": "webpack-sass",
"version": "1.0.0",
"scripts": {
"start": "webpack-dev-server --open --mode development",
"build": "webpack -p"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
@lopspower
lopspower / README.md
Last active April 19, 2024 13:59
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@YuriyGuts
YuriyGuts / github-clone-all.py
Last active January 1, 2024 11:20
Clone all public and private repositories from a specific GitHub user or organization
#!/usr/bin/env python
"""
Clone all public and private repositories from a GitHub user or organization.
Copyright (c) 2018 Yuriy Guts
usage: github-clone-all.py [-h] [--auth-user AUTH_USER]
[--auth-password AUTH_PASSWORD] [--clone-user USER]
[--clone-org ORG]
var turn = 1, withAi, firstMove, hard;
// Set all blocks taken to false
blockTaken0 = false,
blockTaken1 = false,
blockTaken2 = false,
blockTaken3 = false,
blockTaken4 = false,
blockTaken5 = false,
@blixt
blixt / prng.js
Last active January 14, 2024 07:01
A very simple, seedable JavaScript PRNG. NOTE: Please read comments on why this is not a good choice.
// NOTICE 2020-04-18
// Please see the comments below about why this is not a great PRNG.
// Read summary by @bryc here:
// https://github.com/bryc/code/blob/master/jshash/PRNGs.md
// Have a look at js-arbit which uses Alea:
// https://github.com/blixt/js-arbit
/**