Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
# Add this to your nginx.conf under http { } | |
server { | |
listen 843; | |
server_name localhost; | |
location / { | |
rewrite ^(.*)$ /crossdomain.xml; | |
} |
// Usage: | |
// p(instance)('privateMethod)(arg1, arg2, arg3) | |
class PrivateMethodCaller(x: AnyRef, methodName: String) { | |
def apply(_args: Any*): Any = { | |
val args = _args.map(_.asInstanceOf[AnyRef]) | |
def _parents: Stream[Class[_]] = Stream(x.getClass) #::: _parents.map(_.getSuperclass) | |
val parents = _parents.takeWhile(_ != null).toList | |
val methods = parents.flatMap(_.getDeclaredMethods) | |
val method = methods.find(_.getName == methodName).getOrElse(throw new IllegalArgumentException("Method " + methodName + " not found")) |
package com.recursivity.commons.bean.scalap | |
import scala.tools.scalap.scalax.rules.scalasig._ | |
import tools.scalap._ | |
import scalax.rules.scalasig.ClassFileParser.{ConstValueIndex, Annotation} | |
import reflect.generic.ByteCodecs | |
import java.io.{StringWriter, ByteArrayOutputStream, PrintStream} |
trait Enum { //DIY enum type | |
import java.util.concurrent.atomic.AtomicReference //Concurrency paranoia | |
type EnumVal <: Value //This is a type that needs to be found in the implementing class | |
private val _values = new AtomicReference(Vector[EnumVal]()) //Stores our enum values | |
//Adds an EnumVal to our storage, uses CCAS to make sure it's thread safe, returns the ordinal | |
private final def addEnumVal(newVal: EnumVal): Int = { import _values.{get, compareAndSet => CAS} | |
val oldVec = get |
#!/usr/bin/env python3 | |
""" | |
Tests http mirrors of cygwin | |
""" | |
import random | |
import time | |
from urllib.request import urlopen | |
import sys | |
__author__ = 'Dmitry Sidorenko' |
Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
def interday(symbol:String, range:String) = Action {request => | |
Async { | |
WS.url("http://api.sproutwerks.com/api/TimeSeries/TimeSeries.svc").withHeaders(CONTENT_TYPE -> "application/soap+xml").post(ChartRequests.interdayRequest(symbol, range)).map { response => | |
Ok(timeSeriesToJson(range.toUpperCase, response.xml, noFilter, timeLabeler(range))).as(JSON) | |
} | |
} | |
} | |
def intraday(symbol:String) = Action {request => | |
Async { |
class Cell[T](value: T) { | |
var other: T = value | |
} | |
object Test { | |
def g[T, U](x: T, y: U) = if (util.Random.nextBoolean) x else y | |
def f1 = g(1f, "abc") | |
def f2 = g(1: Byte, "abc") | |
def f3 = g(f1, f2) | |
/*** Inferred return types: |
The Union Type Quiz | |
=================== | |
0. Please give your typing approach an intuitive name: | |
Consistent, Unified Subsumption | |
1. Please describe the guiding principle of your typing approach in one sentence: | |
#chat-box.ubuntu.hidden-xs | |
.closed | |
.pull-right | |
= link_to_function content_tag(:i, nil, class: 'glyphicon glyphicon-chevron-up').html_safe, 'chat.show()' | |
.m-l-small | |
= link_to_function 'Chat with us', 'chat.show()' | |
.opened{style: 'display: none'} | |
.header | |
.pull-right | |
= link_to_function content_tag(:i, nil, class: 'glyphicon glyphicon-plus-sign').html_safe, 'chat.maximize()', class: 'maximize', style: 'display: none' |