Skip to content

Instantly share code, notes, and snippets.

View ron-wolf's full-sized avatar
🙌
Open for work!

Ron Wolf ron-wolf

🙌
Open for work!
View GitHub Profile
@wayneeseguin
wayneeseguin / gist:1095634
Created July 20, 2011 18:51
My thought on improving Ruby construct end syntax.
# I have now programmed in a lot of languages, and one thing I can say for sure
# is that shell scripting does construct end styles very well.
#
# Example from http://redmine.ruby-lang.org/issues/5054
#
# This is indeed also one of my few personal issues with Ruby syntax, the end trail.
#
module MyModule
class MyClass
#!/bin/sh
py2=$(which python2 2>/dev/null)
py3=$(which python3 2>/dev/null)
py=$(which python 2>/dev/null)
oldcol="\033[31;1m"
newcol="\033[32;1m"
arrowcol="\033[33;1m"
@WillNess
WillNess / ChurchList.hs
Last active June 7, 2017 20:44
Church-encoded Lists are efficient?
http://stackoverflow.com/questions/15589556/why-are-difference-lists-not-an-instance-of-foldable
/15593349?noredirect=1#comment22277557_15593349
a = singleton 1 singleton x = ChurchList $ \k z -> k x z
b = snoc a 2 snoc xs x = ChurchList $ \k z -> runList xs k (k x z)
c = snoc b 3
d = append c c append u v = ChurchList $ \k z -> runList u k (runList v k z)
runList a k z = k 1 z a := ChurchList $ \k z -> k 1 z
runList b k z = runList a k (k 2 z) = k 1 (k 2 z) b := ChurchList $ \k z -> runList a k (k 2 z)
#!/bin/bash
function rxvt_set_bg { #arg: filename
FILE="$(realpath "$1")"
BGDATA="$(convert "$FILE" -crop '1x1+0+0' txt:-)" #get color of top-left pixel for background
RGB="$(echo "$BGDATA" | grep -P -o '(?<=\().*(?=\))')"
R="$(echo "$RGB" | awk -F ',' '{print $1}')" #get value of each
G="$(echo "$RGB" | awk -F ',' '{print $2}')" #color to determine
B="$(echo "$RGB" | awk -F ',' '{print $3}')" #if background is dark or bright
@jhrr
jhrr / Functional Core, Imperative Shell
Last active January 8, 2018 16:11
Notes and links for ideas about Gary Bernhardt's "functional core, imperative shell"
http://www.infoq.com/presentations/Simple-Made-Easy
http://www.infoq.com/presentations/integration-tests-scam
http://blog.thecodewhisperer.com/2010/09/14/when-is-it-safe-to-introduce-test-doubles
http://youtu.be/yTkzNHF6rMs
http://pyvideo.org/video/1670/boundaries
http://skillsmatter.com/podcast/ajax-ria/enumerators
http://alistair.cockburn.us/Hexagonal+architecture
http://c2.com/cgi/wiki?PortsAndAdaptersArchitecture
http://www.confreaks.com/videos/977-goruco2012-hexagonal-rails
http://www.confreaks.com/videos/1255-rockymtnruby2012-to-mock-or-not-to-mock
; ModuleID = 'hello'
@.str = private constant [14 x i8] c"Hello, World!\00"
declare i32 @puts(i8* nocapture) nounwind
define i32 @main() {
%1 = call i32 @puts(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0))
ret i32 0
}
@steveklabnik
steveklabnik / main.rs
Created October 25, 2017 16:06
The Results of the Expressive C++17 Coding Challenge in Rust
use std::env;
use std::io;
use std::io::prelude::*;
use std::fs::File;
#[derive(Debug)]
enum Error {
Io(io::Error),
Program(&'static str),
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vedant
vedant / gist:9333992
Last active May 27, 2020 06:46
Export note files from Google Keep
/* Vedant Misra (vedantmisra.com) (github.com/vedant)
*
* Script for exporting Google Keep note files.
*
* This does not handle attachments or checklists, only note files. Downloads
* each note to a .txt file named for the note's title.
*
* To use this, go to https://drive.google.com/keep/ and wait for the page to
* fully load all of your saved notes; scroll to the bottom to confirm they're
* loaded. Then paste the below in your URI bar, go to the start of the line,
@deanveloper
deanveloper / ContractEmbedding.md
Last active November 18, 2020 08:34
Contract Embedding - A revised version of my previous proposal, https://gist.github.com/deanveloper/c495da6b9263b35f98b773e34bd41104

Unifying the ideas of Contracts and Interfaces - Contract Embedding

This proposal is largely based on my previous proposal, which can be found here. It had a few problems though, which are fixed by this proposal.

It is unclear how to represent operators using interface methods. We considered syntaxes like +(T, T) T, but that is confusing and repetitive. Also, a minor point, but ==(T, T) bool does not correspond to the == operator,