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
prices = [] | |
10.times do | |
prices << rand(1..100) | |
end | |
p "Today's prices are #{prices.join(', ')}" | |
min = max = prices.first | |
profit = 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
{ | |
Field = "Table with Everything"; | |
Rows = ( | |
{ | |
Fields = ( | |
{ | |
Uid = "522_73"; | |
Values = ( | |
); | |
}, |
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 Person < ActiveRecord::Base | |
end | |
class Staff < Person | |
end | |
class Teacher < Staff | |
end | |
> Person.all.to_sql // "SELECT \"people\".* FROM \"people\"" |
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
Incident Identifier: 57DEF0EE-1D59-4D9F-B964-F50AEDAF84E8 | |
CrashReporter Key: feb41b2edb9ca5ec937b84d25db077c80c5c2d24 | |
Hardware Model: iPod5,1 | |
Process: aggregated [28] | |
Path: /System/Library/PrivateFrameworks/AggregateDictionary.framework/Support/aggregated | |
Identifier: aggregated | |
Version: ??? | |
Code Type: ARM (Native) | |
Parent Process: launchd [1] |
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
ActiveRecord::StatementInvalid (PG::SyntaxError: ERROR: syntax error at or near ")" | |
LINE 20: ...(CASE WHEN lower(partners_languages.language) IN () THEN 1 E... | |
^ | |
: | |
SELECT users.id FROM ( | |
SELECT users.id, (CASE WHEN lower(users.my_sector) = lower('Real Estate') THEN users.score + 2 ELSE users.score END) AS score | |
FROM ( | |
SELECT users.id, users.my_sector, SUM(location) AS score | |
FROM ( | |
SELECT |
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
#for css | |
body#search{ | |
... | |
} | |
#for js | |
- if $('body#search').length | |
...... | |
#for layout view file, e.g. applicaiton.html.haml |
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
<youtube-video data-code='hkk68&$'></youtube-video> | |
<template> | |
<iframe src="http://youtube.com/#{youtube-code}/"></iframe> | |
</template> | |
<!-- I want use the youtube-video element with code to get the iframe of of YouTube video --!> | |
<!-- Is it possible to make youtube-code in template generic as a variable whose value is data-code in youtube-video? --!> | |
<!-- The template is more complex than above in reality by the way --!> |
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
validates_presence_of :account, message: 'cant_be_blank' | |
#/config/locales/any_name_can_do.en.yml | |
en: | |
error_messages: | |
account: | |
cant_be_blank: "you have to fill in account field!" |
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 Calendar | |
def initialize(:view, :data, :callback) | |
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
module ActiveRecord | |
module ConnectionAdapters | |
class PostgreSQLAdapter < AbstractAdapter | |
module Quoting | |
def type_cast(value, column, array_member = false) | |
return super(value, column) unless column | |
case value | |
when Range | |
return super(value, column) unless /range$/ =~ column.sql_type |