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
# Created in response to Stack Overflow question: | |
# http://stackoverflow.com/questions/38504004/interpolate-multiline-string-with-correct-indent | |
module CoreExtensions | |
module String | |
module Heredoc | |
# Special character to flag lines that are part of a multiline HEREDOC interpolation | |
# Any character that is not part of the output string will work. Using "\r" because | |
# it's rarely used in hard-coded strings. |
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 template(from, to, options = {}) | |
template_path = File.expand_path("../../templates/#{from}", __FILE__) | |
template = ERB.new(File.new(template_path).read).result(binding) | |
upload! StringIO.new(template), to, mode: 0644 # Otherwise it's set to 0640, which is not readable by other users (https://github.com/net-ssh/net-scp/blob/master/lib/net/scp/upload.rb#L63) | |
sudo "chown root:root #{to}" if options[:as_root] | |
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
#!/bin/bash | |
while true ; do echo -e "HTTP/1.1 200 OK\n\n $(date)" | nc -l -p 1501 ; done |
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
<% | |
# | |
# I originally needed to create a sidebar partial that had a div area where I could place custom links into. Finally found it. | |
# When I was trying to figure this out before and realized I needed to pass the view into :layout, rather than just using render 'layout'. Not sure why the block can't be passed otherwise but nonetheless... | |
# | |
# For explanation of options see | |
# http://guides.rubyonrails.org/layouts_and_rendering.html#options-for-render | |
# | |
%> |
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
.text-xs-left { text-align: left; } | |
.text-xs-right { text-align: right; } | |
.text-xs-center { text-align: center; } | |
.text-xs-justify { text-align: justify; } | |
@media (min-width: @screen-sm-min) { | |
.text-sm-left { text-align: left; } | |
.text-sm-right { text-align: right; } | |
.text-sm-center { text-align: center; } | |
.text-sm-justify { text-align: justify; } |
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
<request> | |
<dyn_variable name="authenticity_token" ></dyn_variable> | |
<http url="/registrations/new" version="1.1" method="GET"></http> | |
</request> | |
<request subst="true"> | |
<http url="/registrations" method="POST" version="1.1" | |
contents="authenticity_token=%%_authenticity_token%%&first_name=Jane"/> | |
</request> |
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 point_in_polygon?(polygonPoints) | |
return false if self.latitude.blank? or self.longitude.blank? | |
polygonPoints.each do |point| | |
point[0] = point[0].to_f | |
point[1] = point[1].to_f | |
end | |
contains_point = false | |
i = -1 | |
j = polygonPoints.size - 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
Converting md files to html w/highlighting | |
0a) Create a root directory to pull in all the repos | |
0b) Recursively clone or pull each repo | |
$> git clone <repo_url> | git pull on the existing repos | |
0c) Create a TOC index.html file for the root folder | |
$> echo '<head>' >> index.html | |
$> echo '' >> index.html | |
$> echo '</head>' >> index.html | |
$> echo '<body>' >> index.html | |
$> ls >> temp.html |
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 | |
# Load Rails | |
ENV['RAILS_ENV'] = ARGV[0] || 'production' | |
DIR = File.dirname(__FILE__) | |
require DIR + '/../config/environment' | |
# ... do stuff that requires using your rails models |
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
Place phone call. | |
Home? | |
Leave message | |
Wait for callback | |
"Would you like to share a meal" | |
"Would you like to share a meal" | |
What is the response (A) ? | |
"Do you enjoy a hot beverage" | |
What is the response (B) ? | |
n = 0 |
OlderNewer