Skip to content

Instantly share code, notes, and snippets.

View mkempe's full-sized avatar
💭
I may be slow to respond.

Maik Kempe mkempe

💭
I may be slow to respond.
View GitHub Profile
@mkempe
mkempe / gist:3799263
Created September 28, 2012 11:22
Dr. Evil
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 / capybara_extensions.rb
Created July 18, 2012 10:42
Testing rspec views with capybara
# encoding: utf-8
module RSpec
module Support
module Views
module CapybaraExtensions
def rendered
Capybara.string(@rendered)
end
@mkempe
mkempe / multiple_ajax_request_with_jquery.js
Created February 18, 2012 23:53
Multiple Ajax request with jQuery
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 / copyFooAction
Created November 1, 2011 12:04
Copy function to clone an existing object in Extbase.
<?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 / encoding_kung_fu.rb
Created May 5, 2011 15:35
Encoding Kung Fu
#!/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
* Graticule (http://github.com/collectiveidea/graticule)
* geokit-gem (http://github.com/andre/geokit-gem)
* geokit-rails (http://github.com/andre/geokit-rails)
* nanoc (http://nanoc.stoneship.org)
* Jekyll (http://github.com/mojombo/jekyll)
* Serve (http://github.com/jlong/serve)
* Webby (http://webby.rubyforge.org)
@mkempe
mkempe / table.tex
Last active August 29, 2015 13:57
Table with „tabulary“ and line breaks
%\usepackage{longtable}
%\usepackage{tabulary}
\newcommand{\cellOneOne}{ \textbf{Foobar} }
\newcommand{\cellOneTwo}{ \textbf{Foobar} }
\newcommand{\cellOneThree}{ \textbf{Foobar} }
% ----- ----- ----- ----- ----- ----- ----- ----- -----
@mkempe
mkempe / class.coffee
Last active August 29, 2015 13:56
Coffeescript template for jQuery Plugin + Class.
class @Awesome
defaults:
isItAwesome: true
constructor: (element, options) ->
@element = $ element
@options = $.extend { }, @defaults, options
setup.call @