Skip to content

Instantly share code, notes, and snippets.

@ajayk
ajayk / nginx.conf
Created February 14, 2014 09:02 — forked from plentz/nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@ajayk
ajayk / s3.js
Created February 23, 2014 08:48 — forked from nosolopau/s3.js
var crypto = require("crypto");
var moment = require("moment")
var s3 = {
generateS3Policy: function (fileName) {
var s3Policy = {
'conditions': [
{'bucket': CONF.s3.bucket},
['starts-with', '$key', 'uploads/' + fileName],
{'acl': 'public-read'},
local ffi = require "ffi"
local sha512 = require "resty.sha512"
local aes = require "resty.aes"
local ffi_new = ffi.new
local ffi_str = ffi.string
local C = ffi.C
local setmetatable = setmetatable
local error = error
@ajayk
ajayk / designer.html
Last active August 29, 2015 14:07
designer
<link rel="import" href="../chart-js/chart-js.html">
<link rel="import" href="../core-ajax/core-ajax.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
@ajayk
ajayk / gist:b0cd49cf37faf309d8a7
Created January 6, 2015 09:16
proxy streaming
listen 9191 default_server;
server_tokens off;
location / {
# proxy_pass 'http://ajaytestsomething.appspot.com/';
resolver 8.8.8.8;
content_by_lua '
-- http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.5.1
local HOP_BY_HOP_HEADERS = {
location / {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST,PUT,OPTIONS,DELETE,PATCH';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.3.1</version>
</dependency>
new WebDriverWait(driver, 45) {
}.until(new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver drv) {
return drv.findElement(By.id("stateProvinceDropdown-US"))
.isDisplayed();
}
});
/** Like assertEquals, but fails at the end of the test (during tearDown) */
public void verifyEquals(boolean s1, boolean s2) {
try {
assertEquals(new Boolean(s1), new Boolean(s2));
} catch (Error e) {
verificationErrors.append(throwableToString(e));
}
}
Checkout from http://google-styleguide.googlecode.com/svn/trunk, revision HEAD, Fully recursive, Externals included
C:\styles\styleguide.xsl
C:\styles\javascriptguide.xml
C:\styles\xmlstyle.html
C:\styles\google_python_style.vim
C:\styles\google-c-style.el
C:\styles\objcguide.xml
C:\styles\cppguide.xml
C:\styles\intellij-java-google-style.xml
C:\styles\styleguide.css