Skip to content

Instantly share code, notes, and snippets.

View ihavenonickname's full-sized avatar
🔬
Searching

Gabriel ihavenonickname

🔬
Searching
  • The Future
View GitHub Profile
@lubien
lubien / negative-number-matrix.js
Last active March 21, 2017 00:09 — forked from ronaiza-cardoso/negative-number-matrix.js
Count Negative Integers in Matrix
const
composeN = (...fs) => y =>
fs.reduceRight((x, f) => f(x), y)
, flatten = xs =>
xs.reduce((acc, x) => acc.concat(x))
, filter = pred => xs =>
xs.filter(pred)
@dpritchett
dpritchett / naur.md
Last active January 10, 2023 18:58
Programming as Theory Building

Programming as Theory Building

Peter Naur, 1985

(copied from http://alistair.cockburn.us/ASD+book+extract%3A+%22Naur,+Ehn,+Musashi%22)

Introduction

The present discussion is a contribution to the understanding of what programming is. It suggests that programming properly should be regarded as an activity by which the programmers form or achieve a certain kind of insight, a theory, of the matters at hand. This suggestion is in contrast to what appears to be a more common notion, that programming should be regarded as a production of a program and certain other texts.

@praeclarum
praeclarum / AlgorithmW.fs
Last active March 19, 2024 17:44
Algorithm W - or Hindley-Milner polymorphic type inference - in F#
module AlgorithmW
// HINDLEY-MILNER TYPE INFERENCE
// Based on http://catamorph.de/documents/AlgorithmW.pdf
// (Now at http://web.archive.org/web/20170704013532/http://catamorph.de/documents/AlgorithmW.pdf)
type Lit =
| LInt of int
| LBool of bool
@carlosmcevilly
carlosmcevilly / gist:2221249
Created March 27, 2012 22:55
fix git commit with wrong email address in git config, before pushing
If:
- you add and commit with the wrong email address in git, and
- your remote has a hook set up to prevent you from pushing with the bad address
Then you need to amend the author of your commit before push can succeed:
1. fix your email address in git config:
$ git config user.name "Your Name"
@rnewman
rnewman / gist:2010895
Created March 10, 2012 09:04
All records
1331367079.48: {id:"7JLnOIfoVqzC", type:"bookmark", title:"Getting Started", parentName:"Bookmarks Toolbar", bmkUri:"http://www.mozilla.com/en-US/firefox/central/", tags:[], keyword:null, description:null, loadInSidebar:false, parentid:"toolbar"}
1331367079.48: {id:"CmxPKUsOViAm", type:"query", queryId:"RecentlyBookmarked", title:"Recently Bookmarked", parentName:"Bookmarks Menu", bmkUri:"place:folder=BOOKMARKS_MENU&folder=UNFILED_BOOKMARKS&folder=TOOLBAR&queryType=1&sort=12&maxResults=10&excludeQueries=1", tags:[], keyword:null, description:null, loadInSidebar:false, parentid:"menu"}
1331367079.48: {id:"XQOZVUA21FpS", type:"bookmark", title:"Customize Firefox", parentName:"Mozilla Firefox", bmkUri:"http://www.mozilla.com/en-US/firefox/customize/", tags:[], keyword:null, description:null, loadInSidebar:false, parentid:"Rh3DElws6CrW"}
1331367079.48: {id:"YBtokzk3UMOi", type:"query", queryId:"MostVisited", title:"Most Visited", parentName:"Bookmarks Toolbar", bmkUri:"place:redirectsMode=2&sort=8&maxResults=10",
@tomstuart
tomstuart / gist:1466504
Created December 12, 2011 10:40
FizzBuzz in the lambda calculus in Ruby
>> IF = -> b { b }
=> #<Proc:0x007fb4e4049cc8 (lambda)>
>> LEFT = -> p { p[-> x { -> y { x } } ] }
=> #<Proc:0x007fb4e403d680 (lambda)>
>> RIGHT = -> p { p[-> x { -> y { y } } ] }
=> #<Proc:0x007fb4e4028ff0 (lambda)>
>> IS_EMPTY = LEFT
@igstan
igstan / parser.js
Created June 9, 2011 13:29
JavaScript Monadic Parser Combinators
var bind = function (prev, bridge) {
return function (input) {
var result = prev(input);
return result.length === 0 ? result : bridge(result[0])(result[1]);
};
};
var result = function (a) {
return function (input) {
return [a, input];
@hgmnz
hgmnz / query_planner.markdown
Created March 23, 2011 14:14
PostgreSQL query plan and SQL performance notes

Types of index scans

Indexes

Sequential Scan:

  • Read every row in the table
  • No reading of index. Reading from indexes is also expensive.
@jamis
jamis / kruskals.rb
Created December 28, 2010 04:16
An implementation of Kruskal's algorithm for generating mazes.
# --------------------------------------------------------------------
# An implementation of Kruskal's algorithm for generating mazes.
# Fairly expensive, memory-wise, as it requires memory proportional
# to the size of the entire maze, and it's not the fastest of the
# algorithms (what with all the set and edge management is has to
# do). Also, the mazes it generates tend to have a lot of very short
# dead-ends, giving the maze a kind of "spiky" look.
# --------------------------------------------------------------------
# NOTE: the display routine used in this script requires a terminal
# that supports ANSI escape sequences. Windows users, sorry. :(