Skip to content

Instantly share code, notes, and snippets.

@mmiliaus
mmiliaus / SVN.md
Last active August 29, 2015 14:03

101

git clone url -> svn checkout url
git pull -> svn update

git diff -> svn diff | less
git status -> svn status

git add -> svn add
git rm -> svn rm

Controllers

php artisan controller:make PhotoController

Views

## Assets

@mmiliaus
mmiliaus / Collections.scala
Last active January 1, 2016 06:19
Functional Programming Principles in Scala
// Vectors
val nums = Vector(1, 2, 3, -88)
x +: xs // Create a new vector with leading element x, followed by all elements of xs.
xs :+ x // Create a new vector with trailing element x, preceded by all elements of xs.
// Ranges
val r: Range = 1 until 5

Controller

Request

  • get request parameter: $request->getParameter('id')

Redirect

$this->redirect($this->generateUrl('job_show_user', $job));

<?php
// find record by ID
$article = Doctrine_Core::getTable('Article')->find(123);
// set multi attributes in one go
$article->fromArray(array(
'Title' => 'My first article',
'Content' => 'This is my very first article.\n Hope you enjoy it!',
));
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:9001</value>
<description>The host and port that the MapReduce job tracker runs
at.</description>
</property>
#!/usr/bin/env /usr/bin/ruby
STDIN.each_line do |line|
m = line.match /Score="(\d+)"/
if m
puts "LongValueSum:#{m[1]}\t1"
end
end
#!/usr/bin/env ruby
posts_count = 0
last_key = nil
STDIN.each_line do |line|
key, value = line.split("\t")
if last_key && last_key != key
puts "#{last_key}\t#{posts_count}"
last_key, posts_count = key, value.to_i
#!/usr/bin/env ruby
STDIN.each_line do |line|
m = line.match /Score="(\d+)"/
if m
puts "#{m[1]}\t1"
end
end

Mac OSX

LZO

brew install lzop lzo

Hadoop

  • Compile Hadoop LZO library: