This file contains hidden or 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
| # Throw this in config/initializers and add | |
| # @import variables.sass to the top of application.sass | |
| # to have all variables in app_config.yml | |
| # available as variables in your sass stylesheets | |
| # | |
| # First draft by unixmonkey (http://gist.github.com/323198) | |
| # flatten method added by J. R. Schmid <[email protected]> | |
| app_config = YAML::load(File.open(File.join(RAILS_ROOT, 'config', 'app_config.yml'))) |
This file contains hidden or 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 Week < ActiveRecord::Base | |
| has_many :days | |
| def activities | |
| activities = [] | |
| days.each {|day| activities = activities | day.activities} | |
| return activities | |
| end | |
| end |
This file contains hidden or 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
| # Adapted from the recently uploaded Rails initializer file for | |
| # loading the content of app_config.yml into a variables.sass file. | |
| # | |
| # Useful for: | |
| # | |
| # Flattening a Hash, i.e.: | |
| # irb> {:foo => :bar, :foobar => {:foo => :bar}}.flatten | |
| # => {"foobar_foo"=>:bar, "foo"=>:bar} | |
| class Hash |
This file contains hidden or 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
| root@gaia:~$ rvm 1.9.2 | |
| root@gaia:~$ rvm info | |
| ruby-1.9.2-p136: | |
| system: | |
| uname: "OpenBSD gaia 4.5 GENERIC.MP#2133 amd64" | |
| bash: "/usr/local//bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-unknown-openbsd4.5)" | |
| zsh: "/usr/local//bin/zsh => zsh 4.3.9 (x86_64-unknown-openbsd4.5)" |
This file contains hidden or 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
| muaddib@gaia:~$ gem install iconv | |
| Fetching: iconv-0.1.gem (100%) | |
| Building native extensions. This could take a while... | |
| ERROR: Error installing iconv: | |
| ERROR: Failed to build gem native extension. | |
| /usr/local//rvm/rubies/ruby-1.8.7-p330/bin/ruby extconf.rb | |
| checking for iconv() in iconv.h... no | |
| checking for iconv() in -liconv... no | |
| ... |
This file contains hidden or 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
| create_table :files do |t| | |
| t.string :image | |
| end |
This file contains hidden or 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
| SELECT id, | |
| TIMESTAMPADD(HOUR, 1, starts_on) AS starts_on, | |
| TIMESTAMPADD(HOUR, 1, ends_on) AS ends_on, | |
| user_id | |
| FROM activity_years | |
| WHERE YEAR(starts_on) = ? OR YEAR(ends_on) = ?; |
This file contains hidden or 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
| SELECT id, user_id, | |
| CASE | |
| WHEN HOUR(starts_on) = 22 THEN TIMESTAMPADD(HOUR, 2, starts_on) | |
| WHEN HOUR(starts_on) = 23 THEN TIMESTAMPADD(HOUR, 1, starts_on) | |
| END AS starts_on, | |
| CASE | |
| WHEN HOUR(ends_on) = 21 THEN TIMESTAMPADD(HOUR, 2, ends_on) | |
| WHEN HOUR(ends_on) = 22 THEN TIMESTAMPADD(HOUR, 1, ends_on) | |
| END AS ends_on | |
| FROM activity_years |
This file contains hidden or 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
| SELECT id, user_id, activity_month_id, activity_week_id, | |
| CASE | |
| WHEN HOUR(starts_on) = 22 THEN DATE(TIMESTAMPADD(HOUR, 2, starts_on)) | |
| WHEN HOUR(starts_on) = 23 THEN DATE(TIMESTAMPADD(HOUR, 1, starts_on)) | |
| ELSE DATE(starts_on) | |
| END AS starts_on, | |
| CASE | |
| WHEN HOUR(ends_on) = 21 THEN DATE(TIMESTAMPADD(HOUR, 2, ends_on)) | |
| WHEN HOUR(ends_on) = 22 THEN DATE(TIMESTAMPADD(HOUR, 1, ends_on)) | |
| ELSE DATE(ends_on) |
This file contains hidden or 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
| [core] | |
| repositoryformatversion = 0 | |
| filemode = true | |
| bare = false | |
| logallrefupdates = true | |
| [remote "origin"] | |
| fetch = +refs/heads/*:refs/remotes/origin/* | |
| url = ssh://... | |
| [branch "master"] | |
| remote = origin |
OlderNewer