Just testing this out for now.
Here's some explicitly marked java code:
import java.lang.String;
public static void main(String args[]) {
System.out.println("cheese v3.0");
}
import org.scribe.extractors.UrlParameterExtractor; | |
// import ... | |
public class TwitterAuth extends Controller { | |
public static void signInWithTwitter() throws Exception { | |
Token requestToken = Twitter.getService().getRequestToken(); | |
Cache.set(requestToken.getToken(), requestToken, "60min"); | |
String authorizationUrl = Twitter.getService() | |
.getAuthorizationUrl(requestToken); |
Just testing this out for now.
Here's some explicitly marked java code:
import java.lang.String;
public static void main(String args[]) {
System.out.println("cheese v3.0");
}
Scala encourages developers to create data structures that cannot be modified.
To create an immutable list:
val fruits = List("apple", "pear", "orange")
Concatenate two lists:
Use foreach to iterate over a list
val fruits = List("banana", "orange", "strawberry", "apple", "pear")
fruits.foreach(fruit => println(fruit))
For simple operations you can just use an underscore instead of naming the argument:
Use List.map() to transform a list of elements into another list:
val fruitPics = List("banana.jpg", "orange.jpg", "strawberry.jpg", "apple.jpg")
val fileSizes = fruitPics.map(fruit => new java.io.File(parentDir, fruit).length)
// fileSizes: List(12321423, 643423, 234233, 2342343)
Forked | |
This is gist. | |
There are many like it, but this one is mine. | |
It is my life. | |
I must master it as I must master my life. | |
Without me gist is useless. | |
Without gist, I am useless. |
var _ = require('underscore'); | |
var async = require('async'); | |
var config = require('config'); | |
var request = require('superagent'); | |
var conntrack = require('service-base').net.conntrack; | |
var logger = require('service-base').logger; | |
var errorHandler = require('errorhandler'); | |
var httpProxy = require('http-proxy'); | |
var iphash = require('./iphash'); | |
var env = process.env.NODE_ENV || 'development'; |
// Config looks like this: | |
/* | |
proxy: { | |
port: 5000, | |
// Indicates if there is a PROXY protocol enabled Load Balancer | |
// between us and the client | |
useProxyProtocol: true, | |
status: { | |
path: '/status.json', | |
// How many times can a host fail to respond before it is |
/* eslint-env mocha */ | |
'use strict' | |
const chai = require('chai') | |
const dirtyChai = require('dirty-chai') | |
const expect = chai.expect | |
chai.use(dirtyChai) | |
const CRDT = require('../') | |
const transmit = require('./transmit') |
const Decimal = require('decimal.js'); | |
function cdf(n, k, p) { | |
const probability = new Decimal(p); | |
const lambda = new Decimal(n).times(probability); | |
let total = new Decimal(0); | |
for (let i = 0; i <= n-k; i++) { | |
const res = lambda.pow(i).dividedBy(factorial(i)); | |
total = total.plus(res); | |
} |