Skip to content

Instantly share code, notes, and snippets.

View chunkydotdev's full-sized avatar
🍦
Thinking of icecream

Magnus Junghard chunkydotdev

🍦
Thinking of icecream
View GitHub Profile
let breedData = await ckContract.breedWithAuto(pair.matronId, pair.sireId, function(err, response){
console.log('err',err,'response',response)
})
let ckAddress = '0x06012c8cf97bead5deae237070f9587f8e7a266d';
web3.eth.defaultAccount = web3.eth.accounts[0];
let aContract = web3.eth.contract(ckABI);
let ckContract = aContract.at(ckAddress);
let value = web3.toWei(0.008, 'ether')
let data = ckContract.breedWithAuto.getData(pair.matronId, pair.sireId);
@chunkydotdev
chunkydotdev / 1202-alarm
Last active December 2, 2019 21:49
Adventure of code Day 2 Problem 2 in Typescript
export default class RocketComputer {
constructor() {
let opCode = [1, 12, 2, 3, 1, 1, 2, 3, 1, 3, 4, 3, 1, 5, 0, 3, 2, 1, 10, 19, 1, 6, 19, 23, 1, 13, 23, 27, 1, 6, 27, 31, 1, 31, 10, 35, 1, 35, 6, 39, 1, 39, 13, 43, 2, 10, 43, 47, 1, 47, 6, 51, 2, 6, 51, 55, 1, 5, 55, 59, 2, 13, 59, 63, 2, 63, 9, 67, 1, 5, 67, 71, 2, 13, 71, 75, 1, 75, 5, 79, 1, 10, 79, 83, 2, 6, 83, 87, 2, 13, 87, 91, 1, 9, 91, 95, 1, 9, 95, 99, 2, 99, 9, 103, 1, 5, 103, 107, 2, 9, 107, 111, 1, 5, 111, 115, 1, 115, 2, 119, 1, 9, 119, 0, 99, 2, 0, 14, 0];
let problem1Result = this.calculateIntCodeList(opCode);
console.log('position 0 number: ', problem1Result[0]);
let problem2Result = this.calculateIntCodeNounAndVerb(opCode, 19690720);
console.log('100 * noun + verb is: ', problem2Result);
}
public calculateIntCodeList(memory: number[]): number[] {
@chunkydotdev
chunkydotdev / Day 3 - Crossed Wires
Created December 3, 2019 19:27
Adventure of code - Day 3 Crossed Wires in typescript
interface ICoordinate {
x: number;
y: number;
}
export default class WireCalculator {
constructor() {
const distanceToClosestIntersection = this.calculateClosestIntersection(['R1005', 'D32', 'R656', 'U228', 'L629', 'U59', 'L558', 'D366', 'L659', 'D504', 'R683', 'U230', 'R689', 'U489', 'R237', 'U986', 'L803', 'U288', 'R192', 'D473', 'L490', 'U934', 'L749', 'D631', 'L333', 'U848', 'L383', 'D363', 'L641', 'D499', 'R926', 'D945', 'L520', 'U311', 'R75', 'D414', 'L97', 'D338', 'L754', 'U171', 'R601', 'D215', 'R490', 'U164', 'R158', 'U499', 'L801', 'U27', 'L671', 'D552', 'R406', 'U168', 'R12', 'D321', 'L97', 'U27', 'R833', 'U503', 'R950', 'U432', 'L688', 'U977', 'R331', 'D736', 'R231', 'U301', 'L579', 'U17', 'R984', 'U399', 'L224', 'U100', 'L266', 'U184', 'R46', 'D989', 'L851', 'D739', 'R45', 'D231', 'R893', 'D372', 'L260', 'U26', 'L697', 'U423', 'L716', 'D573', 'L269', 'U867', 'R722', 'U193', 'R889', 'D322', 'L743', 'U371', 'L986', 'D835', 'R534', 'U170', 'R946', 'U271', 'L514', 'D521', 'L781',
### Keybase proof
I hereby claim:
* I am storken on github.
* I am magnusjunghard (https://keybase.io/magnusjunghard) on keybase.
* I have a public key ASCRm5Q8mW8g3VeyPfvnjDKa_GcXA0KzVuuhAb21K2thVAo
To claim this, I am signing this object:
import React from 'react';
import styled from 'styled-components';
const Button = styled.button`
border: 1px solid black;
background-color: white;
padding: 10px;
color: black;
transition: 0.2s all;
pointer: cursor;
@chunkydotdev
chunkydotdev / fishbubble.tsx
Created March 9, 2022 14:37
Fishbubble in typescript
import styled from 'styled-components'
const FishBubble = styled.div<{ x: number; y: number }>`
top: ${({ y }) => y}%;
left: ${({ x }) => x}px;
position: absolute;
height: 4px;
width: 4px;
background-color: white;
animation: up 1.5s linear forwards;
@chunkydotdev
chunkydotdev / efficient-fishbubble.tsx
Created March 9, 2022 15:13
Fishbubble using the attrs method
import styled from 'styled-components'
const FishBubble = styled.div.attrs(({ y, x }: { y: number; x: number }) => ({
style: {
top: `${y}%`,
left: `${x}px`
}
}))`
position: absolute;
height: 4px;
@chunkydotdev
chunkydotdev / theme.ts
Created March 14, 2022 15:52
Small styled components theme
export const theme = {
spacings: {
xs: '4px',
sm: '8px',
md: '16px',
lg: '32px',
xl: '64px'
},
colors: {
primary: '#00A6FB',
@chunkydotdev
chunkydotdev / App.tsx
Created March 14, 2022 15:56
Applying theme provider with styled components
import { ThemeProvider } from 'styled-components'
import { theme } from './theme.ts'
const App = () => {
return <>
<ThemeProvider theme={theme}>
<Component1 />
<Component2 />
<Component3 />