Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View hmans's full-sized avatar
🚀
Let's go!

Hendrik Mans hmans

🚀
Let's go!
View GitHub Profile
@hmans
hmans / Gemfile
Created September 20, 2012 15:00
My Gemfile
source 'https://rubygems.org'
# Bundler 1.2.0 allows for specifying the required Ruby version in the Gemfile,
# so let's do that here.
ruby '1.9.3'
# Rails, obviously.
gem 'rails', '3.2.8'
# I love HAML.
@frostney
frostney / gist:4402499
Created December 28, 2012 22:22
Rudimentary Entity-Component-model in CoffeeScript
class Entity
componentList = {}
constructor: (@name = @constructor.name) ->
get: (componentName) ->
if componentName
componentList[componentName]
else
Object.keys componentList
@hmans
hmans / gist:4492893
Last active October 7, 2016 13:54
A common environment variable for Ruby version switchers?

bash-it and ohmyzsh are two popular frameworks for extending the functionality of Bash and ZSH, respectively. One of their features is a built-in themeing system, and both implementations already try to integrate with some (but not all) Ruby version switchers to display the currently active Ruby as part of the shell prompt. At least in bash-it's case, this integration appears to have started out supporting RVM only, with support for rbenv and rbfu added later. This results in unfortunate code like this example.

We've recently agreed to use .ruby-version instead of switcher-specific files (.rbfu-version, .rbenv-version etc.), maybe we can also find a simple common name for an environment variable containing the currently selected Ruby (including patchlevel)?

Right now, the two alternatives I'm seeing are:

  1. Implementing switcher-specif
# create a /backups directory
mkdir /backups
# tar everything except system directories (and the backups directory itself)
tar -cvpf /backups/fullbackup.tar --directory=/ --exclude=proc --exclude=sys --exclude=dev/pts --exclude=backups .
@hmans
hmans / application.html.slim
Last active October 27, 2023 17:52
Application layout for Rails (4 and 5), Slim style.
doctype html
html
head
title My App
meta name="viewport" content="width=device-width, initial-scale=1.0"
= stylesheet_link_tag "application", media: 'all', 'data-turbolinks-track' => true
= javascript_include_tag "application", 'data-turbolinks-track' => true
= csrf_meta_tags
body
@losinggeneration
losinggeneration / main.lua
Last active October 13, 2016 15:37
A Löve2D main.lua bootstrap file for Moonscript. This loads main.moon during development so moonc isn't required. It also has the nice side effect of automatically being overwritten when moonc is run so the game is ready to be distributed.
--[[
DO NOT MAKE CHANGES TO THIS FILE!
This file will purposefully overwritten when moonc is run. However it provides
an easy way to do Moonscript development without having to use moonc to compile
to Lua.
]]--
--[[
License (MIT)
@hmans
hmans / elixir_phoenix_notes.md
Last active April 4, 2018 12:33
Notes on learning Elixir and Phoenix

Notes on learning Elixir and Phoenix

Just some assorted notes I've made while digging into Phoenix, Elixir and friends. I'm coming from a strong Rails background, so many of these will refer to features from that framework.

Views / Templates

Biggest difference from Rails?

Unlike Rails, where rendering is almost always performed by a template file, the responsibility of rendering a response in Phoenix lies with a view module (that typically corresponds to the current controller module.) This view module will typically offer a whole bunch of render functions (matching different parameters, first and foremost the template name.) Templates (found in web/templates/) will directly compile into such functions.

@nothings
nothings / kotaku_hzd.md
Last active January 23, 2024 15:24
Why Frustum Culling Matters, and Why It's Not Important

There is a nice GIF illustrating a technique called "frustum culling" in this Kotaku article: http://kotaku.com/horizon-zero-dawn-uses-all-sorts-of-clever-tricks-to-lo-1794385026

The interwebs being what they are, this has also led to some controversy.

Some people have interpreted the opening sentence "Every time you move the camera in Horizon Zero Dawn, the game is doing all sorts of under-the-hood calculations, loading and unloading chunks of world to ensure that it all runs properly," as being about the GIF; that's not what frustum culling does, but that's probably not what the article's author meant anyway.

@hmans
hmans / application.html.slim
Created December 3, 2017 09:32
Rails 5.2 Slim Application Layout
doctype html
html
head
title My Rails 5.2 App
meta name="viewport" content="width=device-width, initial-scale=1.0"
= csrf_meta_tags
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
= javascript_include_tag 'application', 'data-turbolinks-track': 'reload'
body
@hmans
hmans / application.html.slim
Created March 27, 2020 10:59
Rails 6.0 Slim Application Layout
doctype html
html
head
title My App
meta name="viewport" content="width=device-width, initial-scale=1.0"
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload'
= csrf_meta_tags
= csp_meta_tag