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
| public static FieldViewModel GetField(this HtmlHelper<IEnumerable<FieldViewModel>> Html, string fieldId) | |
| { | |
| FieldViewModel field = Html.ViewData.Model.SingleOrDefault(f => f.FieldId == fieldId); | |
| return field; | |
| } |
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
| ######################## | |
| ## Ruby color helpers ## | |
| ######################## | |
| require 'clipboard' | |
| def css_color(text, output_type = "rgba") | |
| if text.start_with? "#" | |
| if text.length > 4 | |
| colors = [text[1..2].to_i(16).to_s(10), text[3..4].to_i(16).to_s(10), text[5..6].to_i(16).to_s(10), 1] | |
| else | |
| colors = [(text[1]*2).to_i(16).to_s(10), (text[2]*2).to_i(16).to_s(10), (text[3]*2).to_i(16).to_s(10), 1] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| ruby -run -e httpd . -p5000 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| # ... | |
| # Helper Function | |
| def index_content | |
| require 'open-uri' | |
| if self.content.present? && self.content.url.present? && self.content.url.downcase.ends_with?("pdf") | |
| uri = URI.join HOSTNAME, self.content.url | |
| io = open(uri) | |
| reader = PDF::Reader.new(io) | |
| reader.pages.collect(&:text).join | |
| 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
| cd ~ | |
| sudo yum update | |
| sudo yum install java-1.7.0-openjdk.i686 -y | |
| wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.0.tar.gz -O elasticsearch.tar.gz | |
| tar -xf elasticsearch.tar.gz | |
| rm elasticsearch.tar.gz | |
| mv elasticsearch-* elasticsearch | |
| sudo mv elasticsearch /usr/share |
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 = exports ? this | |
| root.Logger = | |
| class Logger | |
| constructor: (options = {}) -> | |
| @mapping = options.mapping ? { | |
| error: (message) -> | |
| console.error.call console, message | |
| warn: (message) -> | |
| console.warn.call console, message | |
| info: (message) -> |
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
| var title = ''; | |
| var message = ''; | |
| var alert = Ti.UI.createAlertDialog({title:'', message:message}); | |
| alert.show(); |
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
Show hidden characters
| { | |
| "color_scheme": "Packages/RailsCasts Colour Scheme/RailsCastsColorScheme.tmTheme", | |
| "folder_exclude_patterns": | |
| [ | |
| ".bundle", | |
| ".git", | |
| ".svn", | |
| ".sass-cache", | |
| "doc", | |
| "log", |