Skip to content

Instantly share code, notes, and snippets.

@jmatsushita
jmatsushita / README
Last active April 28, 2024 14:42
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.
@lightdiscord
lightdiscord / default.nix
Last active October 13, 2022 04:41
Rust and wasm with nixos
with import <nixpkgs> {
overlays = map (uri: import (fetchTarball uri)) [
https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz
];
};
stdenv.mkDerivation {
name = "rust-wasm";
buildInputs = [
cargo-web
@pauldwhitman
pauldwhitman / excelStampDutyNewSouthWalesAustralia-LongForm
Last active October 2, 2023 00:11
Microsoft Excel formula for calculating stamp duty in New South Wales (NSW), Australia. Long form edition without "magic numbers".
=ROUND(IF(A1>3000000,(0.0125*14000)+(0.015*(30000-14000))+(0.0175*(80000-30000)+(0.035*(300000-80000)+(0.045*(1000000-300000))))+(0.055*(3000000-1000000))+0.07*(A1-3000000),IF(A1>1000000,(0.0125*14000)+(0.015*(30000-14000))+(0.0175*(80000-30000)+(0.035*(300000-80000)+(0.045*(1000000-300000))))+0.055*(A1-1000000),IF(A1>300000,(0.0125*14000)+(0.015*(30000-14000))+(0.0175*(80000-30000)+(0.035*(300000-80000)))+0.045*(A1-300000),IF(A1>80000,(0.0125*14000)+(0.015*(30000-14000))+(0.0175*(80000-30000))+0.035*(A1-80000),IF(A1>30000,(0.0125*14000)+(0.015*(30000-14000))+0.0175*(A1-30000),IF(A1>14000,(0.0125*14000)+0.015*(A1-14000),A1*0.0125)))))),)
@richardscarrott
richardscarrott / !react-enzyme-render-methods.md
Last active September 9, 2020 01:39
react-enzyme - `shallow` vs `mount` vs `render` lifecycle methods

An exploration of the different render methods available in react-enzyme.

@jamestalmage
jamestalmage / How_Require_Extensions_Work.md
Last active February 28, 2024 18:22
Breakdown of How Require Extensions Work

Why

Doing require extensions correctly is essential, because:

  1. Users should be able to install multiple extensions in succession, and have them work together.
  2. Coverage tools like nyc need it to reliably supply coverage information that takes into account sourcemaps from upstream transforms.
  3. Because non-standard, un-predictable behavior causes hard to solve bugs, and major headaches for project maintainers.

What is a require extension anyways?

@possibilities
possibilities / meteor-async.md
Created August 23, 2012 22:53
Meteor Async Guide

From Meteor's documentation:

In Meteor, your server code runs in a single thread per request, not in the asynchronous callback style typical of Node. We find the linear execution model a better fit for the typical server code in a Meteor application.

This guide serves as a mini-tour of tools, trix and patterns that can be used to run async code in Meteor.

Basic async

Sometimes we need to run async code in Meteor.methods. For this we create a Future to block until the async code has finished. This pattern can be seen all over Meteor's own codebase:

@giates
giates / LICENSE
Created July 17, 2012 18:20
Play framework 2 Unique Constraint using Java/Ebean
Copyright [2012] [Gianluca Tessarolo]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@svnlto
svnlto / pre-commit.sh
Created July 11, 2012 07:23
jshint git pre-commit hook
#!/bin/sh
# Pre-commit hook passing files through jshint
ROOT_DIR=$(git rev-parse --show-toplevel) # gets the path of this repo
CONF="--config=${ROOT_DIR}/build/config/jshint.json" # path of your jshint config
JSHINT=$(which jshint) # jshint path
if git rev-parse --verify HEAD >/dev/null 2>&1
then
@Yasushi
Yasushi / ivysettings.xml
Created May 3, 2012 03:39
playのeclipsify with-sources=true 対策
<ivysettings>
<!-- Build.scalaのsettingsにexternalIvySettings()を追加すると有効 -->
<caches useOrigin="true"/>
<settings defaultResolver="play"/>
<resolvers>
<chain name="play">
<filesystem name="1">
<!-- ここは絶対パスじゃないとだめ。playの${sbt.ivy.home}は相対パスだった -->
<artifact pattern="/Users/yasushi/src/play/play-2.0/repository/local/[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" />
</filesystem>
@btoone
btoone / curl.md
Last active April 2, 2024 20:18
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin