This file contains hidden or 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
| relayhost = smtp.mandrillapp.com:submission | |
| # http://www.zulius.com/how-to/set-up-postfix-with-a-remote-smtp-relay-host/ | |
| smtpd_sasl_auth_enable = yes | |
| smtpd_sasl_path = smtpd | |
| smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd | |
| smtp_sasl_type = cyrus | |
| smtp_sasl_auth_enable = yes | |
| smtp_sasl_security_options = noanonymous |
This file contains hidden or 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 counter(colAdd, rowAdd) { | |
| var count = 1; | |
| var x, y; | |
| for (x = move.col + colAdd, y = move.row + rowAdd; | |
| isOwnedByCurrentPlayer(x, y); | |
| count++, x += colAdd, y += rowAdd) { | |
| } | |
| for (x = move.col - colAdd, y = move.row - rowAdd; | |
| isOwnedByCurrentPlayer(x, y); | |
| count++, x -= colAdd, y -= rowAdd) { |
This file contains hidden or 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
| python -m py_compile script.py |
This file contains hidden or 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
| Secure sessions are easy, but it's not very well documented, so I'm changing that. | |
| Here's a recipe for secure sessions in Node.js when NginX is used as an SSL proxy: | |
| The desired configuration for using NginX as an SSL proxy is to offload SSL processing | |
| and to put a hardened web server in front of your Node.js application, like: | |
| [NODE.JS APP] <- HTTP -> [NginX] <- HTTPS -> [CLIENT] | |
| To do this, here's what you need to do: |
This file contains hidden or 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
| var express = require('express'); | |
| var multer = require('multer'); | |
| var app = express(); | |
| app.configure(function(){ | |
| app.set('port', process.env.PORT || 3000); | |
| }); | |
| app.post('/parse', multer().any(), function (req, res) { | |
| var from = req.body.from; |
This file contains hidden or 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
| package com.claimtowers.common.asynctask; | |
| public class AsyncTaskResult<T> { | |
| private T result; | |
| private Exception exception; | |
| public AsyncTaskResult(T result) { | |
| this.result = result; | |
| } |
This file contains hidden or 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 java.sql.Date; | |
| import java.sql.PreparedStatement; | |
| import java.sql.SQLException; | |
| import java.sql.Types; | |
| import java.time.LocalDate; | |
| import org.skife.jdbi.v2.StatementContext; | |
| import org.skife.jdbi.v2.tweak.Argument; | |
| import org.skife.jdbi.v2.tweak.ArgumentFactory; |
This file contains hidden or 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
| // | |
| // USAGE: | |
| // | |
| // jdbi.registerColumnMapper(new LocalDateColumnMapper()); | |
| // | |
| import java.sql.Date; | |
| import java.sql.ResultSet; | |
| import java.sql.SQLException; | |
| import java.time.LocalDate; |
This file contains hidden or 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
| LC_NUMERIC="en_US.UTF-8" |
This file contains hidden or 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
| fun <A, B> transformAsyncPair(futureA: ListenableFuture<A>, futureB: ListenableFuture<B>, executor: Executor): ListenableFuture<Pair<A, B>> { | |
| return Futures.transformAsync(futureA, AsyncFunction<A, Pair<A, B>> { a -> | |
| Futures.transformAsync(futureB, AsyncFunction<B, Pair<A, B>> { b -> | |
| Futures.immediateFuture(Pair<A, B>(a!!, b!!)) | |
| }, executor) | |
| }, executor) | |
| } |