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
class Time | |
class << self | |
def next(day, from = nil) | |
day = [:sunday,:monday,:tuesday,:wednesday,:thursday,:friday,:saturday].find_index(day) if day.class == Symbol | |
one_day = 60 * 60 * 24 | |
original_date = from || now | |
result = original_date | |
result += one_day until result > original_date && result.wday == day | |
result | |
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
pod spec lint --local --verbose | |
> Google-Maps-iOS-SDK | |
Google-Maps-iOS-SDK (1.1.2) - Analyzing on iOS 5.1 platform. | |
Analyzing dependencies | |
Fetching external sources | |
-> Fetching podspec for `Google-Maps-iOS-SDK` from `/Users/jonathanspooner/Documents/git/Specs/Google-Maps-iOS-SDK/1.1.2` |
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
declare -i cnt | |
last_cnt=0 | |
while true | |
do | |
(( cnt = $(grep met=618 access.log | wc -l) )) | |
((difference = $cnt - $last_cnt)) | |
(( last_cnt=$cnt )) | |
echo $difference | |
sleep 60 | |
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
# Controller | |
class People < ActionController::Base | |
# ... Other REST actions | |
def create | |
@person = Person.new(params[:person]) | |
slug = "ABC123#{Time.now.to_i.to_s}1239827#{rand(10000)}" |
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
require 'active_support' | |
require 'date' | |
def format_date d | |
d.strftime("%D %I:%M %p") | |
end | |
week_one_start = DateTime.parse("2016-03-03 4:00 PM") | |
week_one_end = DateTime.parse("2016-03-06 5:30 PM") | |
week_two_start = DateTime.parse("2016-03-09 4:00 PM") |
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
import org.elasticsearch.spark._ | |
import org.elasticsearch.spark.rdd.EsSpark | |
import org.elasticsearch.spark.sql._ | |
// Create a DataFrame to write to ElasticSearch | |
case class SimpsonCharacter(name: String, actor: String, episodeDebut: String) | |
val simpsonsDF = sc.parallelize( | |
SimpsonCharacter("Homer", "Dan Castellaneta", "Good Night") :: |
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
demographics.groovy | |
if (ctx._source.demographics) { | |
match_found = false | |
x = 0 | |
for (d in ctx._source.demographics) { | |
if (d.source == demographic.source) { | |
match_found = true | |
ctx._source.demographics[x] = demographic // will destroy the original object. Any keys could be lost | |
} |
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
# ======================== Elasticsearch Configuration ========================= | |
# | |
# NOTE: Elasticsearch comes with reasonable defaults for most settings. | |
# Before you set out to tweak and tune the configuration, make sure you | |
# understand what are you trying to accomplish and the consequences. | |
# | |
# The primary way of configuring a node is via this file. This template lists | |
# the most important settings you may want to configure for a production cluster. | |
# | |
# Please see the documentation for further information on configuration options: |
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
FROM golang:latest | |
RUN mkdir /app | |
ADD . /app/ | |
WORKDIR /app | |
RUN go build -o main . | |
CMD ["/app/main"] |