Skip to content

Instantly share code, notes, and snippets.

View henriquecarv's full-sized avatar

Henrique Carvalho da Cruz henriquecarv

View GitHub Profile
<body onload="d=m=document;n=Math.random;c=z.getContext`2d`;f=g=>c.fillStyle=g;r=(...y)=>c.fillRect(...y);L=_=>{clearInterval(m);v=i=X=m=s=0;h=71;P=[1,2,3].map(k=>({x:X+=150,y:n()*86}))};L();R=_=>{f`gold`;r(0,0,X,X);f`red`;for({x,y} of P){r(x,0,16,y);r(x,y+48,16,102-y)}r(0,h,8,8);c.fillText(s,0,8)};R();d.onclick=_=>{v=-5;m=m||setInterval('h=h*(h>0);h>=142&&L();h+=v+=0.5;for(p of P){p.x-=2;if(p.x<-31){p.x+=450;p.y=n(s++)*86}p.x<8&&(h<p.y||h>p.y+48)&&L()}R()',35)}"><canvas id=z>
@onlurking
onlurking / programming-as-theory-building.md
Last active April 19, 2024 22:31
Programming as Theory Building - Peter Naur

Programming as Theory Building

Peter Naur

Peter Naur's classic 1985 essay "Programming as Theory Building" argues that a program is not its source code. A program is a shared mental construct (he uses the word theory) that lives in the minds of the people who work on it. If you lose the people, you lose the program. The code is merely a written representation of the program, and it's lossy, so you can't reconstruct

@ramantehlan
ramantehlan / README-Fancy.md
Last active April 22, 2024 13:53
README template I use for most of my projects.

Introduction

  • Add your project logo.
  • Write a short introduction to the project.
  • If you are using badges, add them here.

📒 Index

@ksmithut
ksmithut / .dockerignore
Last active April 26, 2024 14:04
Node Docker Compose nodemon
node_modules
@mendhak
mendhak / update-another-users-pullrequest.md
Last active July 26, 2023 07:35
Update a pull request by pushing to another user's forked repository

Add the other user as a remote

#Using https
git remote add otheruser https://github.com/otheruser/yourrepo.git
# Or - Using SSH
git remote add otheruser git@github.com:otheruser/yourrepo.git

Fetch

git fetch otheruser

@naesheim
naesheim / buildWhenAffected.sh
Last active November 28, 2022 20:20
CircleCi - only build features that has changed
##################
### config.yml ###
##################
version: 2
jobs:
build:
docker:
- image: circleci/python:3.6
steps:
@ziluvatar
ziluvatar / token-generator.js
Last active April 11, 2024 07:10
Example of refreshing tokens with jwt
/**
* Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken
* It was requested to be introduced at as part of the jsonwebtoken library,
* since we feel it does not add too much value but it will add code to mantain
* we won't include it.
*
* I create this gist just to help those who want to auto-refresh JWTs.
*/
const jwt = require('jsonwebtoken');
@rjz
rjz / projects_spec.ts
Created September 30, 2016 19:22
Testing with fetch, fetchmock, and TypeScript
// Example of mocking out global `fetch`
//
// Spec works using Jasmine (via Karma) and _either_ tsc or babel.
//
// $ npm install --save-dev fetch-mock whatwg-fetch
//
// If using `tsc`, grab the type definitions as well:
//
// $ typings --save --global dt~fetch-mock dt~whatwg-fetch