Skip to content

Instantly share code, notes, and snippets.

@stoffie
stoffie / app.js
Last active November 30, 2016 07:03
(function(undefined) {
// @note
// A few conventions for the documentation of this file:
// 1. Always use "//" (in contrast with "/**/")
// 2. The syntax used is Yardoc (yardoc.org), which is intended for Ruby (se below)
// 3. `@param` and `@return` types should be preceded by `JS.` when referring to
// JavaScript constructors (e.g. `JS.Function`) otherwise Ruby is assumed.
// 4. `nil` and `null` being unambiguous refer to the respective
// objects/values in Ruby and JavaScript
// 5. This is still WIP :) so please give feedback and suggestions on how
@stoffie
stoffie / lose.exec
Created November 24, 2016 18:35
I lost it
damiano@Z97P-D3:~/SE2_166312_MealManager$ PORT=3000 sails lift
info: Starting app...
-----------------------------------------------------------------
Excuse my interruption, but it looks like this app
does not have a project-wide "migrate" setting configured yet.
(perhaps this is the first time you're lifting it with models?)

Password slides: pato

@stoffie
stoffie / re.rs
Last active October 4, 2016 09:55
// This code is editable, feel free to hack it!
// You can always return to the original code by clicking the "Reset" button ->
// Regex abstract syntax tree
#[derive(Debug, PartialEq)]
enum ReAst {
Seq(Box<ReAst>, Box<ReAst>),
Star(Box<ReAst>),
Pipe(Box<ReAst>, Box<ReAst>),
![N|Solid](data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMSEhUTEhMVFRUWGBgYFxcXFxgaFxodFxgXFxcYGB0aHTQhGh4lHRUVITEhJyorLi4uFx8zODMtNygtLisBCgoKDg0OGxAQGyslICErLS0tLTI3LS03LS0tLS0tKy0tLS8wLS0vLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLf/AABEIAG0A8AMBIgACEQEDEQH/xAAcAAABBAMBAAAAAAAAAAAAAAAABQYHCAEDBAL/xABEEAACAAQDBQUDCQQJBQAAAAABAgADBBEFEiEGBzFBURMiYXGBMpGhI0JSYnKCkrHRCBTC0iQzNENEU6LB4RUWc5Pw/8QAGgEBAAMBAQEAAAAAAAAAAAAAAAIDBAEFBv/EACgRAAICAQQBAwMFAAAAAAAAAAABAhEDBBIhMRMFQVEUYYEWMpGh0f/aAAwDAQACEQMRAD8AnGCCCACCNc6cqi7EAdSQBroOMbIAIIIIAILwkY9tLSUS5qmekvoCe8fsrxMMKv36UCEiXKqJvRgqqp/E1/hAEqXgiJpW/iiI71PUg9AJZB8jnj1K370JNjT1Sjrlln32eB2iV4IbWzm3dBXHLInrn/y37j+itqfSHJeBwDCXj2NJSoHYFsxsoXiSFZvyUwptEe7T4m9VN7KXYS5LnUqxLTLFSvQKAeVyfC1jm1eoWDE5v2LcGLyzUR90FWk2Wk1CCrqGBHQx0RGexKzFrElq1paLOuhOqgdkyqOvenOb9LRJYieDKssFNe5HJDZKj1BBBFxAIIIIAIIIIAIIIIAIIIIAIIIIAIIIIAIIIwYAhL9o/G2ApqNTZWzTZg62IWWPfnPuh/7q8fNbhsiY5u6gy3PMtL0ufMWPrEPftD3/AOpJ07Bbfia8d/7PO0ayp06jmOFE7K8q5t31uGA8WW34IAsAYjDetvOFB/RqbK9SR3m4rJBGlxzc30HLiekdu9LeNL
:root {
--black: black;
--white: white;
--red: #05e;
--green: red;
}
body {
background-color: var(--red);
color: var(--white);
# method resolution order
class A:
def foo(self):
print('A.foo')
class B(A):
def foo(self):
print('B.foo')
super().foo()
xrandr --output DVI-D-0 --mode 1920x1080 --rate 144
xmodmap -e "pointer = 3 2 1"
@stoffie
stoffie / basic.rb
Last active January 13, 2016 21:34
# Return a string of greeting
def welcome_message
false
end
def test_welcome_message
assert_equal "Hello, World!", welcome_message
end
# Implement the factorial function
# Find the longest string in a vector
# Count the number of upcased letter in a string
# Reverse an hash inside out, ie:
# {a: :b} becomes {b: :a}
# Find if an array has nested arrays
# Find how deep an array is, ie how many arrays are nested in it