Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

RomyRomy syntacticsugar

🎯
Focusing
View GitHub Profile
@yang-wei
yang-wei / destructuring.md
Last active Aug 14, 2022
Elm Destructuring (or Pattern Matching) cheatsheet
View destructuring.md

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
@bil-bas
bil-bas / rubymas.rb
Last active Dec 10, 2015 — forked from anonymous/rubymas.rb
Overly show-offy implementation, in Ruby, of @syntacticsugar's Twelve Days of Christmas in Clojure.
View rubymas.rb
class Fixnum
def ordinal
%w[first second third fourth fifth sixth seventh eighth ninth tenth eleventh twelfth][self - 1]
end
# Use #to_word rather than #to_s, so it doesn't break any other printing of numbers.
def to_word
%w[one two three four five six seven eight nine ten eleven twelve][self - 1]
end
end
anonymous
anonymous / rubymas.rb
Created Jan 4, 2013
12 days of Rubymas. Based on clojure implementation by @syntacticsugar
View rubymas.rb
class Fixnum
def ordinal
%w[first second third fourth fifth sixth seventh eighth ninth tenth eleventh twelfth][self - 1]
end
# Use #to_word rather than #to_s, so it doesn't break any other printing of numbers.
def to_word
%w[one two three four five six seven eight nine ten eleven twelve][self - 1]
end
end
@bil-bas
bil-bas / 00_overview.md
Created Oct 27, 2012
Ninety-Nine Haskell problems (Haskell)
View 00_overview.md
@sent-hil
sent-hil / gist:3735640
Created Sep 17, 2012
Plan for HackerSchool Fall 2012
View gist:3735640
GOAL: Become a much, much better programmer:
Get better at Ruby and OOP in general,
Open black boxes and see what goes on underneath.
TIME: Oct 22 - Dec 20.
IDEAS (all open sourced):
* Learn how interpreters work.
Status: Finished Scheme interpreter in Ruby. Rewrite in Go?
@ryanwitt
ryanwitt / huffman.py
Last active Nov 29, 2016
silly huffman coding example
View huffman.py
__all__ = (
'frequency_histogram',
'endode_simple',
'decode_simple',
'huffman_tree',
'encode_character',
'encode_huffman',
'hist2dot',
'tree2dot',
)
View 0_the_explanation.md

This example is not my real app, but it's modeled pretty closely to it.

My mom schedules a couple hundred employees at a local warehouse. In their system, a worker can earn "points" for being late or missing shifts. Here we have a sort of summary screen for my mom, who may need to follow up with new employees or discipline employees with concerning levels of points.

Questions that arise as I code something like this:

  • Which objects deserve presenters?
View _html5boilerplate.css.sass
/*
* HTML5 ✰ Boilerplate
*
* What follows is the result of much research on cross-browser styling.
* Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
* Kroc Camen, and the H5BP dev community and team.
*
* Detailed information about this CSS: h5bp.com/css
*
* ==|== normalize ==========================================================
@scottmessinger
scottmessinger / backbone-todos.js
Created Jun 19, 2011
Backbone.js todos vs knockout.js todos
We couldn’t find that file to show.
@fnhipster
fnhipster / html5.haml
Created Apr 9, 2011
HTML5 HAML Template
View html5.haml
!!! 5
%html
%head
%title= "Your Website"
%meta{ :content => "", :name => "description" }
%meta{ :content => "", :name => "author" }
%meta{ :content => "3 days", :name => "revisit-after" }
%link{ :href => "http://creativecommons.org/licenses/by/3.0/", :rel => "license", :title => "Creative Commons Attribution 3.0 Unported License" }
%link{ :href => "/feed", :rel => "alternate", :title => "Atom", :type => "application/atom+xml" }
%link{ :href => "/css/screen.css", :media => "screen", :rel => "stylesheet" }