Skip to content

Instantly share code, notes, and snippets.

Maik Kempe mkempe

Block or report user

Report or block mkempe

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 static-site-generators-in-ruby.txt
* nanoc (http://nanoc.stoneship.org)
* Jekyll (http://github.com/mojombo/jekyll)
* Serve (http://github.com/jlong/serve)
* Webby (http://webby.rubyforge.org)
View location-based-goodness-in-ruby.txt
* Graticule (http://github.com/collectiveidea/graticule)
* geokit-gem (http://github.com/andre/geokit-gem)
* geokit-rails (http://github.com/andre/geokit-rails)
View encoding_kung_fu.rb
#!/usr/bin/env ruby
require 'find'
Find.find(Dir.getwd) do |file| # Get current working directory and iterate over each file
next if file.include?('.svn') # Ignore svn files
system "file -I '#{file}'" # Print file information via file command
end
@mkempe
mkempe / einbeinige.rb
Created Oct 19, 2011
Using ActiveRecord / Nokogiri for xml → database convert action
View einbeinige.rb
# encoding: utf-8
require 'active_record'
require 'mysql2'
require 'nokogiri'
require 'yaml'
ROOT = File.join(File.dirname(__FILE__), '..')
# ActiveRecord::Base.logger = Logger.new('log/debug.log')
@mkempe
mkempe / copyFooAction
Created Nov 1, 2011
Copy function to clone an existing object in Extbase.
View copyFooAction
<?php
// → http://answerpot.com/showthread.php?463705-Cloning%20Model%20and%20add%20to%20repository
public function copyFooAction(Tx_Foo_Domain_Model_Foo $foo) {
$propertyMapper = t3lib_div::makeInstance('Tx_Extbase_Property_Mapper'); // Create new Tx_Extbase_Property_Mapper
$propertyMapper->injectReflectionService(t3lib_div::makeInstance('Tx_Extbase_Reflection_Service'));
$newFoo = new Tx_Foo_Domain_Model_Foo();
$attributes = array('foo',
'bar'
@mkempe
mkempe / multiple_ajax_request_with_jquery.js
Created Feb 18, 2012
Multiple Ajax request with jQuery
View multiple_ajax_request_with_jquery.js
var queue = [];
$.each(foobars, function(i, foobar) { // Built up queue
queue.push($.getJSON(
'http://foobar.com/foo.js', // URL
{ foo: foobar.bar }, // Params
function(data) { // Callback
# ...
));
});
@mkempe
mkempe / capybara_extensions.rb
Created Jul 18, 2012
Testing rspec views with capybara
View capybara_extensions.rb
# encoding: utf-8
module RSpec
module Support
module Views
module CapybaraExtensions
def rendered
Capybara.string(@rendered)
end
View gist:3799263
var selector = angular.element($(".ng-scope")[0]);
var scope = selector.scope();
var grid = scope.$$childTail.grid;
$.each(grid, function(i, row) {
$.each(row, function(j, element) {
element.solve();
});
});
@mkempe
mkempe / gist:3871966
Created Oct 11, 2012
Capistrano: Deploy tag
View gist:3871966
set :branch do
default_tag = `git tag`.split("\n").last
tag = Capistrano::CLI.ui.ask "Tag to deploy [#{default_tag}]: "
tag = default_tag if tag.empty?
tag
end
@mkempe
mkempe / gist:3934476
Created Oct 22, 2012
Scala / MacPorts
View gist:3934476
$ port install scala2.9
$ port install scala_select
$ port select --set scala scala2.9
You can’t perform that action at this time.