think about results, not steps
- First-Class Functions
package main | |
import ( | |
"crypto/tls" | |
"fmt" | |
"log" | |
"net" | |
"net/http" | |
) |
#!/usr/bin/env jruby | |
%W{rails/command/server rack webrick webrick/https}.each { |lib| require lib } | |
ENV['HTTPS'] = 'on' | |
module Rails | |
class Server < ::Rack::Server | |
def default_options | |
super.merge({ |
think about results, not steps
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import java.io.Closeable; | |
import java.io.IOException; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.ScheduledExecutorService; | |
import java.util.concurrent.ScheduledFuture; | |
import java.util.concurrent.TimeUnit; |
I used docker compose to stand up MariaDB and Apache web server in containers.
I'm using php7 with CentOS 7.2. I had to install "php70w-pecl-xdebug.x86_64". I also added the following the Dockerfile
RUN echo "xdebug.idekey = PHPSTORM" >> /etc/php.d/xdebug.ini &&
echo "xdebug.default_enable = 0" >> /etc/php.d/xdebug.ini &&
echo "xdebug.remote_enable = 1" >> /etc/php.d/xdebug.ini &&
echo "xdebug.remote_autostart = 0" >> /etc/php.d/xdebug.ini && \
import "github.com/julienschmidt/httprouter" | |
import "net/http" | |
func doRequest(method, uri string, body *bytes.Buffer, handle httprouter.Handle) (*httptest.ResponseRecorder, error) { | |
resp := httptest.NewRecorder() | |
req, err := http.NewRequest(method, uri, body) | |
if err != nil { | |
return nil, err | |
} |
import { State } from '../shared'; | |
constructor(store: Store<State>) { | |
// this call to errors because I haven't passed a "state" | |
store.select(selectNotificationsByGroupType(), { type: this.group.type }); | |
} |
import { HttpClientTestingModule } from '@angular/common/http/testing'; | |
import { TestBed } from '@angular/core/testing'; | |
import { WindowLocationToken } from '../location'; | |
import { LocationHrefGuard } from './location-href.guard'; | |
describe('LocationHrefGuard', () => { | |
let guard: LocationHrefGuard; | |
const routeMock: any = { | |
snapshot: {}, | |
data: { pathname: '/app/logout.php' }, |
class Application < Rails::Application | |
# MONKEY PATCH | |
# | |
# Calls to request.ssl? aren't working. The ssl? method relies on some environment variable(s) | |
# to be set and doesn't take into account the 'rack.url_scheme'. See ticket #5750 on the Rails | |
# lighthouseapp.com ticketing site. | |
# url: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/5750-requestssl-should-reflect-rackurl_scheme | |
def call(env) |
import ( | |
"bytes" | |
"io" | |
"os" | |
) | |
// not thread safe | |
func captureStdout(f func()) string { | |
old := os.Stdout | |
r, w, _ := os.Pipe() |