Skip to content

Instantly share code, notes, and snippets.

View DogPawHat's full-sized avatar

Ciarán Curley DogPawHat

View GitHub Profile
@DogPawHat
DogPawHat / NumberOfOnes.cpp
Created August 1, 2022 20:46
Cassidoo's number of ones in C++ for some reason
#include <iostream>
int numberOfOnes(int val)
{
int count = 0;
// only one digit
auto numberOfOnesCount = [&count](auto& self, int subval)->void {
if (subval < 10) {
if (subval == 1) {
count++;
@DogPawHat
DogPawHat / main.rs
Created May 30, 2022 16:04
all_unique for cassidoo
use std::env;
use std::collections::HashSet;
fn all_unique(maybe_unique: String, ignore_caps: bool) -> bool {
return maybe_unique.len()
== (if ignore_caps {
maybe_unique.to_lowercase()
} else {
maybe_unique
})
@DogPawHat
DogPawHat / machine.js
Last active August 4, 2021 17:13
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@DogPawHat
DogPawHat / limited_imaginations.ex
Created February 24, 2021 08:33
cassidoo string deletion test
defmodule LimitedImaginations do
@spec check_for_deletion(
String.grapheme(),
{:ok, number(), String.t()}
) :: {:ok, number(), String.t()}
@spec every_other(String.t()) :: {:ok, number(), String.t()}
def check_for_deletion(el, {:ok, 0, ""}) do
{:ok, 0, el}
end
@DogPawHat
DogPawHat / machine.js
Created February 10, 2021 19:15
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@DogPawHat
DogPawHat / machine.js
Created February 4, 2021 15:12
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@DogPawHat
DogPawHat / i-can-explain.md
Created January 27, 2020 14:08
Baby's first code mod

Baby's first codemod

What madness is this?

So I was working on a project recently to update the documentation around Storybook, which involves updating to Storybook 5.3

A neat little feature her is the ablity to write stories and documentaiton in MDX, a glorius love child of JSX and Markdown that enables you to put React componetns into a Markdown file and have it come out the other end.

<Meta title="Examples" decorators={[withKnobs]}/>

Keybase proof

I hereby claim:

  • I am dogpawhat on github.
  • I am dogpawhat (https://keybase.io/dogpawhat) on keybase.
  • I have a public key whose fingerprint is 3F3A A7A3 88DA 47E7 2C96 CECE 2245 E042 7BE7 8306

To claim this, I am signing this object:

@DogPawHat
DogPawHat / yarn-error.log
Created November 2, 2016 12:13
Outdated yarn error
Arguments:
C:\Program Files\nodejs\node.exe C:\Users\CCURLEY\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js outdated
PATH:
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\OpenVPN\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\chocolatey\bin;C:\Program Files\nodejs\;C:\Windows\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\HashiCorp\Vagrant\bin;C:\Users\CCURLEY\AppData\Local\Programs\Python\Python35\Scripts\;C:\Users\CCURLEY\AppData\Local\Programs\Python\Python35\;C:\Users\CCURLEY\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\CCURLEY\AppData\Roaming\npm;C:\Users\CCUR
/*Copyright (c) 2016, Ciarán Curley
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
var arr1 = [1, 2, 3, 4, 5, 6, 7, 8]
var arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]