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
# Guide | |
# Configure the essential configurations below and do the following: | |
# | |
# Repository Creation: | |
# cap deploy:repository:create | |
# git add . | |
# git commit -am "initial commit" | |
# git push origin master | |
# | |
# Initial Deployment: |
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
export JAVA_OPTS='-d32 -client -Xmx1g' | |
alias ls='ls -G' | |
alias ll='ls -l' | |
alias la='ls -la' | |
alias l='ls -l' |
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/ruby | |
# Instructions | |
# - Install optipng + libjpeg (http://mxcl.github.com/homebrew/) | |
# - Put this file in a directory of images | |
# - Open in TextMate + run it (cmd+r) | |
# Config |
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
en: | |
html: | |
escaped: "<h2>lingohub</h2><p>can't wait to see it</p>" | |
raw: "<h2>lingohub</h2><p>can't wait to see it</p>" | |
html_safe: "<h2>lingohub</h2><p>can't wait to see it</p>" | |
ending_html: "<h2>lingohub</h2><p>can't wait to see it</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
1: <%= t 'html.escaped' %> <!-- INCORRECT RESULT: <h2>lingohub</h2><p>can't wait to see it</p2> --> | |
2: <%= raw t('html.raw') %> <!-- CORRECT RESULT: <h2>lingohub</h2><p>can't wait to see it</p> --> | |
3: <%= t('html.html_safe').html_safe %> <!-- CORRECT RESULT: <h2>lingohub</h2><p>can't wait to see it</p> --> | |
4: <%= t 'html.ending_html' %> <!-- CORRECT RESULT: <h2>lingohub</h2><p>can't wait to see it</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
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M | | |
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Controllers | 1729 | 1320 | 41 | 166 | 4 | 5 | | |
| Helpers | 604 | 442 | 1 | 72 | 72 | 4 | | |
| Models | 2133 | 1254 | 33 | 174 | 5 | 5 | | |
| Libraries | 4272 | 3101 | 100 | 373 | 3 | 6 | | |
| Model specs | 1988 | 1232 | 0 | 10 | 0 | 121 | | |
| View specs | 0 | 0 | 0 | 0 | 0 | 0 | | |
| Controller specs | 2656 | 2021 | 0 | 22 | 0 | 89 | |
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
# Character count | |
select sum(length(YOUR_COLUMN)) from YOUR_TABLE; | |
# Word count | |
select sum(array_length(regexp_split_to_array(YOUR_COLUMN, '\s'),1)) from YOUR_TABLE; |
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 | |
require 'bundler' | |
require 'benchmark' | |
REGEXPS = [ | |
/^no such file to load -- (.+)$/i, | |
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i, | |
/^Missing API definition file in (.+)$/i, | |
/^cannot load such file -- (.+)$/i, | |
] |
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
SELECT | |
t.tablename, | |
indexname, | |
c.reltuples AS num_rows, | |
pg_size_pretty(pg_relation_size(quote_ident(t.tablename)::text)) AS table_size, | |
pg_size_pretty(pg_relation_size(quote_ident(indexrelname)::text)) AS index_size, | |
CASE WHEN indisunique THEN 'Y' | |
ELSE 'N' | |
END AS UNIQUE, | |
idx_scan AS number_of_scans, |
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
def import_file_data(file_path, content, import_type, strategy_name, additional_attributes = {}, options = {}) | |
# probably file_path is a String and the result file_name as well | |
file_name = File.basename(file_path) | |
# no idea what tempfile is, a string? | |
tempfile = write_to_temp_file(content, file_name) | |
uploaded_file = OpenStruct.new(:original_filename => file_name, :tempfile => tempfile) | |
# Is this now an instance of ResourceImport or a result of a resource import? | |
resource_import = ResourceImport.import!(user, project, uploaded_file, file_path, import_type, strategy_name, additional_attributes) |