Skip to content

Instantly share code, notes, and snippets.

View afonsomatos's full-sized avatar
🎯
Focusing

Afonso Matos afonsomatos

🎯
Focusing
  • Lisboa, Portugal
View GitHub Profile
@TheHans255
TheHans255 / alias-method.js
Created August 27, 2016 19:13
An Alias Method implementation written in JavaScript
/*
An Alias Method implementation written in JavaScript
Copyright (c) 2016 Hans Jorgensen
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is furnished to do so,
@mlynch
mlynch / Undo.md
Last active April 9, 2024 11:28
Undo/Redo

Undo/Redo

Undo/Redo is one of those features of an application that you almost always need to have if you are building serious GUI tools for people to do work.

The best way to look at undo/redo is two stacks of operations the user has performed:

  • The Undo stack is the "history" of what they've done
  • The redo stack is the breadcrumbs back to the initial state before they started undoing
@sordina
sordina / OverloadedStrings.hs
Last active December 18, 2015 02:58
Overloaded Strings Example
{-# LANGUAGE OverloadedStrings #-}
import GHC.Exts ( IsString(..) )
data Foo = A | B | Other String deriving Show
instance IsString Foo where
fromString "A" = A
fromString "B" = B
fromString xs = Other xs
@ramnathv
ramnathv / gh-pages.md
Created March 28, 2012 15:37
Creating a clean gh-pages branch

Creating a clean gh-pages branch

This is the sequence of steps to follow to create a root gh-pages branch. It is based on a question at [SO]

cd /path/to/repo-name
git symbolic-ref HEAD refs/heads/gh-pages
rm .git/index
git clean -fdx
echo "My GitHub Page" > index.html