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 / application.html.slim
Created November 8, 2016 21:54
Rails 5.0 Application Layout, 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': 'reload'
= javascript_include_tag 'application', 'data-turbolinks-track': 'reload'
= csrf_meta_tags
body
@hmans
hmans / Disabling Rails generators you don't need.md
Last active October 11, 2016 14:00
Disable some Rails generators you don't need to run all the time

Disable some Rails generators you don't need to run all the time

Reasoning: the Rails default is to generate a separate .coffee (or .js) and .scss file for each controller you add to your application. This may not be what you need. Adding the following lines to your development environment's configuration file will prevent this from happening:

# In config/environments/development.rb
config.generators.stylesheets = false
config.generators.javascripts = false
config.generators.helper      = false
defmodule FizzerBuzzer do
def go do
go(1)
end
def go(num) when num == 101 do
end
def go(num) do
cond do
@hmans
hmans / gist:cd5e2e989ceff7ff163a
Last active August 29, 2015 14:03
Ruby Configuration Thingy
class ConfigurationProxy
attr_reader :data
def initialize
@data = {}
end
def method_missing(method, *args, &blk)
if args.any? || block_given?
if block_given?
@hmans
hmans / gist:cf18d182c51fb9191df6
Created June 29, 2014 12:07
PostgreSQL Large Object Data Store for Dragonfly
# This is a Dragonfly data store using PostgreSQL Large Objects. It appears to work fine,
# but I ended up using a different solution in my project. Anyway, here you go.
#
class PostgresDataStore
def write(content, opts={})
data_oid = store_lo(content.data)
meta_oid = store_lo(Marshal.dump(content.meta))
"#{data_oid}/#{meta_oid}"
end
using UnityEngine;
using System.Collections;
public class EndlessSpace : MonoBehaviour {
public GameObject tile;
public GameObject player;
private float width, height;
private Vector3 offset, up, right, down, left;
@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
@hmans
hmans / gmail.css
Created October 2, 2013 15:48
A user stylesheet for Google Mail that hopefully makes the whole thing slightly less terrible.
/* This is a simple user stylesheet for the current version of Google Mail.
I think it makes Gmail's design slightly less terrible. Use it with your
favorite user stylesheet plugin or the excellent MailPlane client.
-- Hendrik Mans <hendrik@mans.de> */
/* Mails */
tr.zA {
height: 1.65em;
}
@hmans
hmans / cheesecake.md
Created August 29, 2013 08:54
Cheesecake! \o/

Zutaten:

Für eine handelsübliche ~26cm-Springform.

Für den Boden:

  • ~175g Vollkornbutterkekse, fein zerböselt
  • 2 EL Zucker
  • Prise Zimt
  • 60g geschmolzene Butter
@hmans
hmans / application_controller.rb
Created July 24, 2013 11:17
Make CanCan 1.6 work with Rails 4 (or Rails 3 with StrongParameters)
class ApplicationController < ActionController::Base
# ...
# Workaround for CanCan vs. SecureParameters.
# Invokes #secure_params and merges the returned hash back into #params.
#
prepend_before_filter only: [:create, :update] do
secure_params.each do |k, v|
params[k] &&= v