Skip to content

Instantly share code, notes, and snippets.

View Iainmon's full-sized avatar
🥶

Iain Moncrief Iainmon

🥶
View GitHub Profile
@bcardiff
bcardiff / for.cr
Last active September 5, 2019 18:09
for crystal
macro for(expr)
{{raise "invalid syntax. use for e in c." unless expr.args.first.name.stringify == "in"}}
{{expr.args.first.args.first}}.each do |{{expr.name.id}}|
{{expr.args.first.block.body}}
end
end
for e in 1..5 do
puts e
end
@CMCDragonkai
CMCDragonkai / let_case_where.hs
Created February 24, 2015 08:00
Haskell: Pattern Matching Deconstructor Assignment (Within Functions)
tuple1 a b = (a, b)
tuple2 a b = (b, a)
-- recursive let
func1 n =
let
(a, b) = tuple1 3 n
(_, y) = tuple2 a b
in
a + b + y
@idleberg
idleberg / Install-Mcrypt.md
Last active June 24, 2025 10:26
Install Mcrypt on macOS

Setup php-mcrypt on macOS (and versions of Mac OS X)

These steps should have been mentioned in the prerequisites of the Laravel Installation Guide, since I'm surely not the only person trying to get Laravel running on macOS.

Install

Install Mcrypt using Homebrew and PECL (comes with PHP)

# PHP 7.3
@leostratus
leostratus / webkit-pseudo-elements.md
Created September 21, 2012 01:44
Webkit Pseudo-Element Selectors (Shadow DOM Elements)

An ongoing project to catalogue all of these sneaky, hidden, bleeding edge selectors as I prepare my JSConf EU 2012 talk.

Everything is broken up by tag, but within each the selectors aren't particularly ordered.

I have not tested/verified all of these. Have I missed some or got it wrong? Let me know. - A

A friendly reminder that you may need to set this property on your target/selected element to get the styling results you want:

-webkit-appearance:none;

@peteb
peteb / gist:964164
Created May 10, 2011 09:28
C++ templates for vector classes (vec3, color4, float2, etc)
#include <iostream>
#include <ctime>
#include <iterator>
// old stuff
template<typename DataType, int NumComponents, typename Derived>
struct composite_base {
typedef DataType value_type;
static const int num_components = NumComponents;