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
# Be sure to restart your server when you modify this file. | |
module ActiveModel | |
module MassAssignmentSecurity | |
module Sanitizer | |
def warn!(attrs) | |
# Raise exception instead of silently corrupting data | |
raise "Can't mass-assign protected attributes: #{attrs.join(', ')}" | |
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
namespace :models do | |
desc 'Check models for problems' | |
task :check => :environment do | |
Dir.glob(RAILS_ROOT + '/app/models/**/*.rb').each do |f| | |
model = eval File.basename(f)[0..-4].camelize | |
next unless model.superclass == ActiveRecord::Base # TODO: handle inheritance | |
print "#{model.name}: " | |
if model.column_names.exclude? model.primary_key | |
abort "bad primary key: #{model.primary_key}" | |
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
relation.all.find {|i| attributes.all? {|k,v| i[k] == v } } |
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
import java.util.Arrays; | |
import java.util.Collection; | |
public class Glommer<T> | |
{ | |
public static <T> Glommer<T> glommer() | |
{ | |
return new Glommer<T>(); | |
} |
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
test: test.c Makefile | |
gcc -O3 -Wall -Werror -std=c99 -o test test.c |
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
# Returns escaped +text+ for use in a JavaScript script tag. | |
# The string is marked html_safe to prevent characters such as | |
# '&' and '<' from being converted to HTML entities, which must | |
# not happen as script tag content is defined to be CDATA. | |
# | |
# Example: | |
# <script>alert('<%= html_safe_js('hello & bye') %>')</script> | |
# | |
# Do not use this function for JavaScript used in an attribute value | |
# such as 'onclick'. In that case, use +escape_javascript+ instead: |
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
private static String decodeText(byte[] bytes, int start, int len) | |
throws CharacterCodingException | |
{ | |
int n = WritableUtils.decodeVIntSize(bytes[start]); | |
return Text.decode(bytes, start + n, len - n); | |
} |
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
cd src/hadoop-lzo | |
tar xzvf ~/Downloads/lzo-2.05.tar.gz | |
cd lzo-2.05 | |
CFLAGS="-arch x86_64" ./configure --build=x86_64-darwin --enable-shared --disable-asm --prefix=$HOME/hadoop-0.20.2/lzo | |
make -j4 | |
make install | |
cd .. | |
env \ | |
JAVA_HOME=/Library/Java/Home \ | |
C_INCLUDE_PATH=$HOME/hadoop-0.20.2/lzo/include \ |
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
coordinator.local-maven-repo.enabled=true | |
coordinator.git-config-repo.uri=/home/ubuntu/config.git | |
coordinator.status.expiration=5s | |
http-server.http.port=64000 | |
node.environment=demo |
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
cd hadoop-snappy | |
# Mac OS X | |
tar xzvf ~/Downloads/snappy-1.0.3.tar.gz | |
cd snappy-1.0.3 | |
./configure --prefix=$(greadlink -m $PWD/../snappy) && make install | |
cd .. | |
# Linux | |
wget http://snappy.googlecode.com/files/snappy-1.0.3.tar.gz |