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
exports = module.exports = functions.https.onCall( | |
httpsOnCallWrapper('helloWorld', helloWorldHandler) | |
) |
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 * as functions from 'firebase-functions' | |
const helloWorldHandler = async () => { | |
// Do exciting function things here | |
return { done: true } | |
} | |
exports = module.exports = functions.https.onCall(helloWorldHandler) |
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 * as Sentry from '@sentry/node' | |
import { https } from 'firebase-functions' | |
Sentry.init( | |
// Add your Sentry configuration here or import it | |
) | |
export const httpsOnCallWrapper = ( | |
// We pass an identifying ‘name’ as a string |
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
version: '2' | |
services: | |
web: | |
build: | |
context: ./ | |
dockerfile: Dockerfile | |
volumes: | |
- ./:/code | |
ports: | |
- 4000:4000 |
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
# What we want to use as a base of our container. | |
# We all know Ubuntu, so why not. | |
FROM ubuntu:14.04 | |
# Some locale setting business, better to have it than not. | |
ENV DEBIAN_FRONTEND=noninteractive | |
RUN locale-gen en_GB.UTF-8 | |
ENV LANG en_GB.UTF-8 | |
ENV LANGUAGE en_GB:en | |
ENV LC_ALL en_GB.UTF-8 |
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 create | |
create! do |success, failure| | |
success.html { flash[:notice] = nil; redirect_to whatever } | |
end | |
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
brew update | |
# skip to line 14 if you have rbenv | |
# and ruby-build installed | |
brew install rbenv ruby-build | |
if [ -n "${ZSH_VERSION:-}" ]; then | |
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.zshrc | |
else | |
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.bash_profile | |
fi |
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 is(method_sym) | |
->(subject) { subject.send method_sym } | |
end | |
case user | |
when is(:admin) then puts 'Woohoo! Admin' | |
when is(:editor) then puts 'Editor' | |
else puts 'User' | |
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
function getPeriods(periods) { | |
var splittedPeriods = periods.match(/\d+(ms|s|m|h|d|o|y)/g); | |
var sum = 0; | |
splittedPeriods.forEach(function(period) { | |
sum += getPeriod(period); | |
}); | |
return sum; | |
}; |
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
hydra = Typhoeus::Hydra.new :max_concurrency => 5 | |
urls = %w(http://www.google.com/ http://engadget.com/ | |
http://rubyonrails.org/ http://railscasts.com/) | |
responses = [] | |
urls.each do |url| | |
req = Typhoeus::Request.new url | |
req.on_complete do |resp| | |
if resp.success? | |
responses << resp.body |