Skip to content

Instantly share code, notes, and snippets.

Hendrik Mans hmans

View GitHub Profile
View EndlessSpace.cs
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 / gist:cd5e2e989ceff7ff163a
Last active Aug 29, 2015
Ruby Configuration Thingy
View gist:cd5e2e989ceff7ff163a
class ConfigurationProxy
attr_reader :data
def initialize
@data = {}
end
def method_missing(method, *args, &blk)
if args.any? || block_given?
if block_given?
View gist:49143
...---...
../ / | \ \..
./ / / | \ \ \.
/ / / | \ \ \
/ / / | \ \ \
^^^^^^^^^^^^^^^^^^^^^^^
\ | /
\ | /
\ | /
\ | /
View gist:49145
.:IIIIHIHHIHHHII::I:.
.IIIIHIHHHHHHIHIIIIMHHI:,
:IIIIHIHHHHHHMMHHIHHIIHHIII:.
.:IHIHHHHHHHHHHHHHIHIHHIHHHIH:I:,
,.:HIHHHHHHHHHHHHHHHHHHHHHIHIHHII:.
,.:IHHHHHHHHHHMMMMHHHHHHHIIHHHIHIII,
View gist:51093
def current_user_session
return @current_user_session if defined?(@current_user_session)
@current_user_session = UserSession.find
end
kürzer:
def current_user_session
@current_user_session ||= UserSession.find
end
View gist:52530
class User < ActiveRecord::Base
validates_uniqueness_of :email, :case_sensitive => false
validate :valid_email?
private
def valid_email?
address = EmailVeracity::Address.new(email)
View application_helper.rb
# place this in application_helper.rb
def set_page_title(title = nil, &block)
if block_given?
html = capture(&block)
concat(html)
end
@page_title = title || strip_tags(html)
end
View gist:52551
- set_page_title "Neuer User"
View gist:52547
def set_page_title(title = nil, &block)
if block_given?
html = capture(&block)
concat(html)
end
@page_title = title || strip_tags(html)
end
You can’t perform that action at this time.