Skip to content

Instantly share code, notes, and snippets.

@behrends
behrends / data.js
Created July 4, 2018 08:53
10:55 - Zitate
const data = [
{
text:
'Probleme kann man niemals mit derselben Denkweise lösen, durch die sie entstanden sind.',
author: 'Albert Einstein'
},
{
text:
'Man braucht nichts im Leben zu fürchten, man muss nur alles verstehen.',
author: 'Marie Curie'
@behrends
behrends / App.js
Created July 4, 2018 08:03
10:05 - Aufbau Komponente
// i.d.R. 3 Blöcke
// 1) imports
// ES 2015!
import React, { Component } from 'react';
// verwendete UI-Komponenten und APIs importieren
import { Button, StyleSheet, Text, View } from 'react-native';
// 2) Komponente
@behrends
behrends / Eingabe.java
Created November 29, 2017 13:55
Eingabe in Java mit Scanner
import java.util.Scanner;
public class Eingabe {
public static void main(String[] args) {
int number = 8;
String text = "Text";
Scanner scanner = new Scanner(System.in);
// Eingabe
System.out.print("Zahl eingeben: ");
@behrends
behrends / tail-recursive.rb
Created August 6, 2011 14:46 — forked from anonymous/tail-recursive.rb
notes on Ruby Tail Call Optimization
# First, I suppose you have ruby 1.9.1 or 1.9.2
# Open irb. Execute this:
# RubyVM::InstructionSequence.compile_option = { tailcall_optimization: true, trace_instruction: false }
# Note, RubyVM::InstructionSequence.compile_option() doesn't have item :trace_instruction, still, you need to specify it. WTF?
# Also, it doesn't work if you just put it to the script. Don't know why yet. Tell me (@rofh) if you know.
# Then open the file:
# require "./tail-recursive"
# Then execute function:
# fact(30000)
var gistPrefix = 'https://gist.github.com/',
// Cache document.write so that it can be restored once all Gists have been
// embedded.
cachedWrite = document.write,
body = $('body'),
// Map each p.gist to an object that contains the paragraph to be replaced
// and the Gist's identifier.
gists = $('a.gist').map(function(n, a) {
a = $(a);
var href = a.attr('href');
@behrends
behrends / private.xml
Created July 5, 2012 09:23
Easy access to Umlauts on MacOS X using KeyRemap4MacBook
<?xml version="1.0"?>
<root>
<item>
<name>Easy access for Umlauts</name>
<identifier>private.easy_umlaut_access</identifier>
<autogen>
--KeyToKey--
KeyCode::A, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L,
KeyCode::U, ModifierFlag::OPTION_L, KeyCode::A, ModifierFlag::SHIFT_L
</autogen>

Using http://github.com/carlhuda/janus so not all of these might be in standard vim

:e - edit file
0 - jump to beginning of line
$ - jump to end of line
^ - jump to first non-whitespace character of a line
e - jump to end of a word
E - jump to whitespace-delimited word
b (B) - jump to previous (whitespace-delimited) word
w (W) - jump to next (whitespace-delimited) word

@behrends
behrends / gist:1032218
Created June 17, 2011 20:17 — forked from dhh/gist:1014971
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end
@behrends
behrends / gist:876627
Created March 18, 2011 18:56 — forked from leshill/gist:870866
javascript dialogs in tests
# Add this to more_web_steps.rb
# Selenium docs: http://code.google.com/p/selenium/wiki/RubyBindings#Javascript_Alert/Confirm today!
When /^I (accept|dismiss) the "([^"]*)" alert$/ do |action, text|
alert = page.driver.browser.switch_to.alert
alert.text.should eq(text)
alert.send(action)
end
@behrends
behrends / skip word on zsh in ubuntu
Created March 16, 2011 09:03
skip word on zsh in ubuntu
#find out key codes like this (type in any combination of keys)
cat > /dev/null
#add this to .zshrc
bindkey "^[[1;3C" forward-word
bindkey "^[[1;3D" backward-word