Skip to content

Instantly share code, notes, and snippets.

Kenneth De Winter kdwinter

Block or report user

Report or block kdwinter

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am kdwinter on github.
  • I am kdwinter (https://keybase.io/kdwinter) on keybase.
  • I have a public key whose fingerprint is 6B53 97C8 5A66 AA0F 4D4C F915 3C0E 8824 60A5 849A

To claim this, I am signing this object:

@kdwinter
kdwinter / Arch-ZFSRoot-on-dm-crypt-UEFI.md
Last active Oct 22, 2019 — forked from aaronlauterer/Arch-ZFSRoot-on-dm-crypt-UEFI
ZFSRoot installation over a dm-crypt volume for Arch Linux (UEFI)
View Arch-ZFSRoot-on-dm-crypt-UEFI.md

Install Arch Linux on root ZFS filesystem

Pre-installation

Download Arch linux

https://archlinux.org

Create bootable USB (don't add partition number!)

View keybase.md

Keybase proof

I hereby claim:

  • I am gigamo on github.
  • I am kdwinter (https://keybase.io/kdwinter) on keybase.
  • I have a public key whose fingerprint is 6B53 97C8 5A66 AA0F 4D4C F915 3C0E 8824 60A5 849A

To claim this, I am signing this object:

@kdwinter
kdwinter / define_method_vs_class_eval.rb
Created Aug 17, 2010
Some interesting Ruby benchmarks
View define_method_vs_class_eval.rb
require 'benchmark'
Benchmark.bm 20 do |x|
x.report "define_method" do
25_000.times do
class MyClass
define_method :foo do
puts 'hi'
end
end
@kdwinter
kdwinter / authenticable.rb
Last active Sep 5, 2015
Authlogic plugin for MongoMapper
View authenticable.rb
module Authenticable
extend ActiveSupport::Concern
included do
key :username, String
key :email, String
key :crypted_password, String
key :password_salt, String
key :persistence_token, String
key :login_count, Integer, :default => 0
@kdwinter
kdwinter / authenticable.rb
Created Jun 14, 2010
Authlogic with Mongoid (in spirit of http://pastie.org/503478)
View authenticable.rb
module Authenticable
def self.included(model)
model.class_eval do
extend ClassMethods
include InstanceMethods
field :username
field :email
field :crypted_password
field :password_salt
View index.html.erb
<% cache 'recent_pages' do %>
<% @pages.each do |page| %>
<%=h page.title %>
<%# ... %>
<% end %>
<% end %>
View authentication.rb
# include this in application controller
module Authentication
protected
# Inclusion hook to make #current_user and #signed_in?
# available as ActionView helper methods.
def self.included(base)
base.send :helper_method, :current_user, :signed_in?, :authorized? if base.respond_to? :helper_method
end
# Returns true or false if the user is signed in.
View database.yml
development: &global_settings
database: textual_development
host: 127.0.0.1
port: 27017
test:
database: textual_test
<<: *global_settings
production:
View partials.rb
# stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb
# and made a lot more robust by me
# this implementation uses erb by default. if you want to use any other template mechanism
# then replace `erb` on line 13 and line 17 with `haml` or whatever
module Sinatra::Partials
def partial(template, *args)
template_array = template.to_s.split('/')
template = template_array[0..-2].join('/') + "/_#{template_array[-1]}"
options = args.last.is_a?(Hash) ? args.pop : {}
options.merge!(:layout => false)
You can’t perform that action at this time.