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
const req = { method: 'POST', path: '/' }; | |
const res = { send: jest.fn() } | |
const request = (req, res) => { | |
return jobs.stack | |
.find((layer) => { | |
return ( | |
layer.route.path === req.path && | |
layer.route.methods[req.method.toLowerCase()] | |
); |
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
# Basic database configuration | |
dbpath = /usr/local/var/mongodb | |
port = 27017 | |
bind_ip = 127.0.0.1 | |
logpath = /usr/local/var/log/mongodb/mongodb.log | |
# logappend = false | |
# Logging | |
cpu = true | |
verbose = true |
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
alias mdb="mongod run --rest --config /usr/local/Cellar/mongodb/2.0.2-x86_64/mongod.conf" | |
alias mdbclear="/bin/echo "" > /usr/local/var/log/mongodb/mongodb.log" | |
alias mdbquery="egrep -c '\w{5,}ms$' /usr/local/var/log/mongodb/mongodb.log" | |
alias mdbindex="egrep -c 'nscanned:\w{5,}ms$' /usr/local/var/log/mongodb/mongodb.log" | |
alias startpg="pg_ctl -D /usr/local/var/postgres -l /usr/local/var/log/postgres/postgres.log start" | |
alias stoppg="pg_ctl -D /usr/local/var/postgres stop -s -m fast" | |
alias stoppow="launchctl stop cx.pow.powd" | |
alias servers="ps aux | egrep 'nginx|php|mongo|mysql|postgres'" | |
alias mocha="./node_modules/mocha/bin/mocha test/_helper.js" | |
alias pgstart="pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start" |
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
<div class="b-video-article__video"> | |
<div id="ctl00_WebTvArticleContent_BaseVideoHolder_VideoPlaceHolder_Satellite_Satellite" class="b-satellite cf" style="height: 416px;"> | |
<object type="application/x-shockwave-flash" data="http://www.expressen.se/Static/swf/ExpPlayer.swf?ver=2.2.10.4479" width="100%" height="416" id="ctl00_WebTvArticleContent_BaseVideoHolder_VideoPlaceHolder_Satellite_PlayerPlaceHolder"><param name="allowFullScreen" value="true"><param name="wmode" value="transparent"><param name="flashvars" value="hasPlaylist=true&embedUrl=http://www.expressen.se/Static/swf/ExpPlayer.swf?ver=2.2.10.4479&xmlUrl=http%3A%2F%2Fwww.expressen.se%2FHandlers%2FWebTvHandler.ashx%3Fid%3D4563932&searchUrl=http%3A%2F%2Fwww.expressen.se%2FHandlers%2FWebTvHandler.ashx%3Fid%3D4563932&playerType=portal&auto=true&hasHeader=false"></object> | |
<meta itemprop="embedURL" content="http://www.expressen.se/Static/swf/ExpPlayer.swf?ver=2.2.10.4479&xmlUrl=http%3a%2f%2fwww.expressen.se%2f |
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
<!-- HTML/JS on adhost page --> | |
<body style="margin:0;padding:0;"> | |
<!-- render ad --> | |
<script type="text/javascript"> | |
sendAdSize = function(e) { | |
if (e.origin == "http://publisher.com") { | |
if(e.data == 'adSize?') { | |
var adWidth = document.getElementsByTagName("img")[0].width; | |
var adHeight = document.getElementsByTagName("img")[0].height; |
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
... | |
field :started_at, type: Date | |
validates_presence_of :started_at, message: 'you have to provide a start-date' | |
validates_date :started_at, on_or_after: :today, on: :create | |
validates_date :started_at, is_at: lambda { |_self| _self.started_at_was }, on: :update, if: lambda { |_self| _self.started_at_was.to_date < Time.now.to_date } | |
validates_date :started_at, on_or_after: :today, on: :update, if: lambda { |_self| _self.started_at_was.to_date >= Time.now.to_date } | |
field :ended_at, type: Date | |
validates_presence_of :ended_at, message: 'you have to provide an end-date' |
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
When /^I fill in all required "(.*?)" fields$/ do |model| | |
klass = model.singularize.camelcase.constantize | |
# Build the class with valid attributes | |
# Requires valid factory | |
valid_model = FactoryGirl.build(model.singularize.to_sym) | |
# Remove ID field(s) | |
valid_model.attributes.delete("_id") if valid_model.attributes.include?("_id") | |
valid_model.attributes.delete("id") if valid_model.attributes.include?("id") |
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
## | |
# Growing Object Oriented Software | |
# Tell, don't ask approach | |
# Tested and learned the principle | |
class SomeProgram | |
def self.runit | |
# Printer is the main purpose | |
# Later I might want to Log, IM, Email or Ping something about the printing result. |
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 | |
WEEK=$(/bin/date +%V) | |
if [ ! -d $HOME/Downloads/week-$WEEK ]; then | |
mkdir $HOME/Downloads/week-$WEEK | |
fi | |
downloadedFiles=($(find $HOME/Downloads -depth 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
user www-data www-data; | |
pid /var/run/nginx.pid; | |
worker_rlimit_nofile 58064; | |
worker_processes 1; | |
events { | |
use epoll; | |
worker_connections 58064; | |
} |
NewerOlder