Skip to content

Instantly share code, notes, and snippets.

View datenimperator's full-sized avatar

Christian Aust datenimperator

View GitHub Profile
$ radiant --database=mysql test
$ sudo gem install thinking-sphinx
$ cd test
# set your mysql credentials for production
$ joe config/database.yml
# add config.gem 'mislav-will_paginate', :lib => 'will_paginate'
$ joe config/environment.rb
$ export RAILS_ENV=production
tell application "Address Book"
set mylist to selection
repeat with this_person in mylist
set new_note to ""
set tmp to (get note of this_person)
set the_paragraphs to the paragraphs of tmp
repeat with the_paragraph in the_paragraphs
if the_paragraph does not contain "CLASS:" and the_paragraph does not contain "xing" then
set new_note to new_note & the_paragraph
end if
#
# MyDocument.rb
# xing2
#
# Created by Christian on 17.04.10.
# Copyright (c) 2010 __MyCompanyName__. All rights reserved.
#
require 'osx/cocoa'
root@v6:~# apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
gitlab-ce
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 355 MB of archives.
After this operation, 78.8 kB of additional disk space will be used.
Do you want to continue [Y/n]?
@datenimperator
datenimperator / gist:829803
Created February 16, 2011 17:48
Hausnummer klein ohne Leerzeichen
"Höhenweg 17 B".gsub(/(\d)\s(\w)$/) { "#{$1}#{$2.downcase}" }
@datenimperator
datenimperator / gist:1010336
Created June 6, 2011 14:10
dmesg on virtual Ubuntu 10.04.2
administrator@router:~$ dmesg
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 2.6.32-32-generic-pae (buildd@roseapple) (gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) ) #62-Ubuntu SMP Wed Apr 20 22:10:33 UTC 2011 (Ubuntu 2.6.32-32.62-generic-pae 2.6.32.38+drm33.16)
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] NSC Geode by NSC
[ 0.000000] Cyrix CyrixInstead
[ 0.000000] Centaur CentaurHauls
@datenimperator
datenimperator / gist:1241937
Created September 26, 2011 09:35
Create instance-based validation
require 'rubygems'
gem 'activemodel', '3.0.10'
require 'active_model'
class ChildValidator < ActiveModel::EachValidator
def validate_each(object, attribute, child)
klass = "#{object.process}_child_validator".camelize.constantize rescue nil
child.validates_with klass unless klass.nil?
unless child.errors.empty?
object.errors[attribute] << child.errors.full_messages
# Compass configuration from inside a rails3 engine
require 'compass'
require 'compass/app_integration/rails'
configuration = StringIO.new(<<-CONFIG)
project_type = :rails
css_dir = "public/stylesheets"
sass_dir = "app/stylesheets"
CONFIG
source :rubygems
# I'd like to go with
# gem "radiant", '~> 1.0.0.rc3'
# there are fixes on master (but not rc3) that are needed for the extensions, thus I'm on edge
gem "radiant", :git => "git://github.com/radiant/radiant.git"
# I forked these to add missing localizations
gem "radiant-clipped-extension", :git=> "git://github.com/datenimperator/radiant-clipped-extension.git"
gem 'radiant-german_language_pack-extension', :git=> "git://github.com/datenimperator/radiant-german_language_pack-extension.git"
c.aust@macbook-pro:~$ curl -I -H 'Accept-Encoding: gzip,deflate' http://budokan-yanagi.de/js/jquery-1.7.1.min.js
HTTP/1.1 200 OK
Date: Thu, 05 Jan 2012 10:58:18 GMT
Server: Apache/2.2.14 (Ubuntu)
ETag: "db2cccefedcc741a45a582e91a5afe8d"
X-Rack-Cache: fresh
X-Content-Digest: d1e1f3f0828fa66fb5744f42bc912694e06300f9
Cache-Control: max-age=2592000, public
Age: 3114
Status: 200