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
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 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 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 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
ruby -run -e httpd . -p5000 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
######################## | |
## 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] |
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
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 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 creation_time | |
,last_execution_time | |
,total_physical_reads | |
,total_logical_reads | |
,total_logical_writes | |
, execution_count | |
, total_worker_time | |
, total_elapsed_time | |
, total_elapsed_time / execution_count avg_elapsed_time | |
,SUBSTRING(st.text, (qs.statement_start_offset/2) + 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
private static MembershipContext _dbContext; | |
public static MembershipContext dbcontext | |
{ | |
get | |
{ | |
if (_dbcontext==null) | |
{ | |
_dbcontext = new MembershipContext(); | |
} | |
return _dbcontext; |