Skip to content

Instantly share code, notes, and snippets.

:shipit:
Shipping!

Sean Clayton sean-clayton

:shipit:
Shipping!
Block or report user

Report or block sean-clayton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 0 ocaml.ml
type maybeString = string option
let myMaybeString: maybeString = Some "howdy"
let myString =
match myMaybeString with
| Some s -> s
| None -> ""
View useTheme.re
let useTheme = () => {
open ReactResponsiveRe;
open Dom.Storage;
open AppStyles;
open AppStyles.ThemeNames;
open AppStyles.ThemeStore;
let prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
let systemTheme =
@sean-clayton
sean-clayton / MyComponent.js
Last active Jun 29, 2019
LiveScript vs JavaScript
View MyComponent.js
import react, {useState, createElement as h} from "react";
// With JSX
function MyComponent() {
const [count, setCount] = useState(0);
return (
<div>
<h1 className="heading" onClick={() => setCount(count + 1)}>
Hello world!
@sean-clayton
sean-clayton / 1-linkedlist.fs
Last active Jun 22, 2019
Linked list operations in a few functional languages
View 1-linkedlist.fs
// F#
type LinkedList<'a> =
| Nil
| Node of 'a * LinkedList<'a>
let head =
function
| Nil -> Nil
| Node(x, _) -> x
View fizzBuzz.fs
let fizzBuzz attempt =
match attempt with
| (0, 0, _) -> "FizzBuzz"
| (0, _, _) -> "Fizz"
| (_, 0, _) -> "Buzz"
| (_, _, n) -> n.ToString()
for num in 1..100 do
printfn "%s" (fizzBuzz (num % 3, num % 5, num))
View fingerprint.js
function FingerprintWrapper(e) {
var t = null,
r = new n();
c.rebuildXMLHttpRequest(e.ajax_header), c.fetchAjaxHeaders(e);
var d = function(n) {
if (!t) {
t = n ? n.type : "manual/other";
var d = function(t) {
var r = a();
if (r) {
View karabiner.json
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
View isBoolean.ts
/**
* Check if the component disabled value is "truthy"
*
* This check is done here due to ngc throwing an error when the logic is in the template
*
* @param disabledValue string or boolean value to evaluate
*/
public isDisabled(disabledValue: boolean | string) {
if (disabledValue === true || disabledValue === "true") {
return true;
View eight_queens.hs
-- Eight queens solution in 5 lines of haskell
solution :: [Int]
solution = head (allSolutions !! 8)
allSolutions :: [[[Int]]]
allSolutions = iterate (concatMap extendSolution) [[]]
extendSolution :: [Int] -> [[Int]]
extendSolution qs = map (:qs) $ filter (`okToAdd` qs) [0..7]
You can’t perform that action at this time.