You can post a json file with curl
like so:
curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION
so for example:
import java.util.Arrays; | |
/** | |
* http://lucitworks.com/Snippets/Algorithms/permutation.htm | |
*/ | |
public class HeapPermute { | |
private static void swap(int[] v, int i, int j) { | |
int t = v[i]; v[i] = v[j]; v[j] = t; | |
} |
application: you-app-name-here | |
version: 1 | |
runtime: python | |
api_version: 1 | |
default_expiration: "30d" | |
handlers: | |
- url: /(.*\.(appcache|manifest)) | |
mime_type: text/cache-manifest |
// found here http://forums.shopify.com/categories/2/posts/29259 | |
var getOrdinal = function(n) { | |
var s=["th","st","nd","rd"], | |
v=n%100; | |
return n+(s[(v-20)%10]||s[v]||s[0]); | |
} |
trait MyList[+A] { | |
def fold[B](k: Option[(A, B)] => B): B | |
def map[B](f: A => B): MyList[B] = sys.error("Implement me in terms of fold") | |
def flatMap[B](f: A => MyList[B]): MyList[B] = sys.error("Implement me in terms of fold") | |
def headOption: Option[B] = sys.error("Implement me in terms of fold") | |
def tailOption: Option[MyList[B]] = sys.error("Implement me in terms of fold") | |
def isEmpty = sys.error("Implement me in terms of fold") | |
def length = sys.error("Implement me in terms of fold") | |
} |
Steps to install and run PostgreSQL 9.2 using Homebrew (Mac OS X) | |
(if you aren't using version 9.1.5, change line 6 with the correct version) | |
1. launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist | |
2. mv /usr/local/var/postgres /usr/local/var/postgres91 | |
3. brew update | |
4. brew upgrade postgresql | |
5. initdb /usr/local/var/postgres -E utf8 | |
6. pg_upgrade -b /usr/local/Cellar/postgresql/9.1.5/bin -B /usr/local/Cellar/postgresql/9.2.0/bin -d /usr/local/var/postgres91 -D /usr/local/var/postgres | |
7. cp /usr/local/Cellar/postgresql/9.2.0/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/ |
function iteratorOfPromisesForEach(iterator, callback) { | |
var snapshot = iterator.next(); | |
if (snapshot.done) { | |
return Promise.resolve(); | |
} | |
return snapshot.value.then(callback).then(() => iteratorOfPromisesForEach(iterator, callback)); | |
} | |
var result = iteratorOfPromisesForEach(filesIterator, function (file) { | |
// return immediately to just do sync processing |
It is easy to get service accounts working with App Engine's app_devserver.py
- once you know how.
On the way there, you might have pulled out all your hair following one documentation dead end after another, trying to piece together the right information.
Here are the steps you need to take, in exact order, to get this working. Once you follow these steps, you'll be able to use service accounts in local development, so that you can interact with Google APIs (e.g.: Spreadsheet, Calendar) in a way that is consistent with the deployment environment on App Engine.
In order to follow the instructions, you'll be better off using the latest UI for Google Cloud projects. Older interfaces (such as the dedicated App Engine dashboard) have things in different places, under different names, etc. It is a world of pain there.
Also note that I've tested this on several 1.9.x releases of App Engine; I can't confirm the behaviour of earlier releases.
var nconf = require('nconf'); | |
var yaml = require('js-yaml'); | |
var app_config = __dirname + '../config/application.yml'; | |
// load cmd line args and environment vars | |
nconf.argv().env(); | |
// load a yaml file using a custom formatter | |
nconf.file({ |
// Overlays one color on top of another and returns the resulting color. | |
// This is used to determine contrast ratio for two colors with partial opacity. | |
// See http://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending | |
@function alpha-blend($overlay, $base) { | |
$overlayAlpha: alpha($overlay); | |
$baseAlpha: alpha($base); | |
// If the overlaid color is completely opaque, then the result is just going to be that color. | |
@if $overlayAlpha >= 1 { | |
@return $overlay; |