This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script lang="ts"> | |
// ====== | |
// Props. | |
// ====== | |
const { Component, slot, ...otherProps } = $$props; | |
</script> | |
<!-- | |
======= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE RebindableSyntax #-} | |
import Prelude hiding ((>>)) | |
data Config = Config { depth :: Int, width :: Int } | |
printInfo :: Config -> IO () | |
printInfo config = mapM_ putStrLn $ do | |
"************** INFORMATION **************" | |
"Welcome to the Hydraulic Press Channel." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf | |
// Remove any duplicates from an array of primitives. | |
const unique = [...new Set(arr)] | |
// Sleep in async functions. Use: await sleep(2000). | |
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms))); | |
// or | |
const sleep = util.promisify(setTimeout); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <time.h> // Robert Nystrom | |
#include <stdio.h> // @munificentbob | |
#include <stdlib.h> // for Ginny | |
#define r return // 2008-2019 | |
#define l(a, b, c, d) for (i y=a;y\ | |
<b; y++) for (int x = c; x < d; x++) | |
typedef int i;const i H=40;const i W | |
=80;i m[40][80];i g(i x){r rand()%x; | |
}void cave(i s){i w=g(10)+5;i h=g(6) | |
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Client | |
attr_reader :key, | |
def initialize(key) | |
@key = key | |
end | |
end | |
Client.new("moo") # results in: ArgumentError: wrong number of arguments (given 1, expected 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, useEffect } from 'react'; | |
export interface UseFetchData<TData> { | |
data: TData; | |
isLoading: boolean; | |
error?: string; | |
} | |
export const useFetchData = <TData>(fetchUrl: string, defaultValue: TData): UseFetchData<TData> => { | |
const [data, setData] = useState<TData>(defaultValue); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { EasingName, easing } from './easingMap'; | |
import { useLayoutEffect, useState, useRef } from 'react'; | |
export interface AnimationIncreaseProps { | |
easingName?: EasingName; | |
duration?: number; | |
diff: number; | |
} | |
export const useIncreaseAnimation = ({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Initially based on https://github.com/sonnym/jekyll_elm | |
# | |
# USAGE: | |
# Copy/paste this file into the `_plugins` directory of your Jekyll project. | |
# For every .elm file in your project, it will generate a .js file in your site | |
# using the same name and relative path. | |
# | |
# As-is, the converter expects the following directory structure: | |
# | |
# your-jekyll-project/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim: set ft=ruby | |
cask_args appdir: '/Applications' | |
tap 'homebrew/cask' | |
brew 'mas' | |
brew 'git' | |
brew 'zsh' | |
brew 'make' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.bykn.list | |
import cats.Applicative | |
import cats.implicits._ | |
/** | |
* Implementation of "Purely Functional Random Access Lists" by Chris Okasaki. | |
* This gives O(1) cons and uncons, and 2 log_2 N lookup. | |
*/ |
NewerOlder