🤷♀️
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Ambiguos | |
def x; 1; | |
def test | |
puts x # method x called | |
x = 2 | |
puts x # variable x | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ObjectWithDatabase | |
{ | |
private $_db; | |
public function __construct( Database_Interface $database = null ) | |
{ | |
if ($database === null) { | |
$this->_db = new Database_Mysql(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'PHPUnit/Framework.php'; | |
class Xml | |
{ | |
public function getNavigation() | |
{ | |
return '<ul id="navigation"> | |
<li><a href="/search">Suche</a></li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class NumberCruncher { | |
public function __call($m, $n) { | |
switch($m = substr($m, -1, 1)) { | |
default: return ($m == 'F') ? (9 * $this->C($n[0])) : ($n[0] * ($n[0] * 0.5)); | |
case 'A': return $n[0] + 4; | |
case 'B': return $n[0] * 3; | |
case 'D': return ($n[0] == 0) ? (1) : ($n[0] * $this->D($n[0] - 1)); | |
case 'E': return ($n[0] > 1) ? ($this->E($n[0] - 1) + $this->E($n[0] - 2)) : ($n[0]); | |
case 'G': return $this->D($n[0]) - $this->E($n[0]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
if [[ -s "${TM_PROJECT_DIRECTORY}/.rvmrc" ]] | |
then | |
source "${TM_PROJECT_DIRECTORY}/.rvmrc" | |
fi | |
`which ruby` $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<title>Kill all style Attributes</title> | |
</head> | |
<body style="color: red;"> | |
<p style="border: 2px solid black;"> | |
Foo | |
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Mail | |
class Message | |
def body_html | |
if html_part.present? | |
html_part.body.to_s | |
elsif mime_type == 'text/html' | |
body.to_s | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# -*- ruby -*- | |
require 'rubygems' | |
require 'daemon_spawn' | |
RAILS_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) | |
class DelayedJobWorker < DaemonSpawn::Base | |
def start(args) | |
ENV['RAILS_ENV'] ||= args.first || 'development' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if defined?(RSpec) | |
namespace :rcov do | |
RSpec::Core::RakeTask.new(:rspec_aggregate) do |task| | |
task.pattern = 'spec/**/*_spec.rb' | |
task.rspec_opts = "--format progress" | |
task.rcov = true | |
task.rcov_opts = "--rails --exclude osx\/objc,spec,gems\/ " + | |
"--aggregate tmp/coverage.data" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# is something like that possible? | |
I18n.with_scope(:scope) do | |
t(:foo) # would be the same as t(:foo, scope: :scope) | |
end |
OlderNewer