Skip to content

Instantly share code, notes, and snippets.

<!-- remote API -->
<servlet>
<display-name>Remote API Servlet</display-name>
<servlet-name>RemoteApiServlet</servlet-name>
<servlet-class>com.google.apphosting.utils.remoteapi.RemoteApiServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>RemoteApiServlet</servlet-name>
@buithaibinh
buithaibinh / graphQLUtils.ts
Created September 12, 2017 10:58 — forked from Groxot/graphQLUtils.ts
GraphQL query generator
// Angular imports
import { isArray, isBlank, isDate, isNumber, isStringMap, isPresent, isString } from 'angular2/src/facade/lang'
export class GraphQLUtils {
static createMutation(data: Object, dataDefinition: Object, method: string, mutationName?: string): string {
if (!method || !data) { return null }
let mutation: string = (mutationName || method) + '{' + method
mutation += '(' + GraphQLUtils.flattenObject(data) + ')'
City.findById(id, (err, city) => {
if (err) {
// oh noes! we got an error
} else {
// okay, found data
}
});
card A {
memo: This is private card,
comments: [
comment#1,
comment#2,
]
}
card B {
memo: This is new memo for new card.
@buithaibinh
buithaibinh / gist:8d7b2a449e16ef5f5f80278ba4dffd19
Created August 8, 2019 04:19
Map subdomains to URLs in nginx with WordPress.
server {
listen 80;
listen 443 ssl;
server_name ~^(?<user>[a-zA-Z0-9-]+)\.example\.com$;
location / {
resolver 8.8.8.8;
rewrite ^([^.]*[^/])$ $1/ permanent;
proxy_pass_header Set-Cookie;
proxy_pass $scheme://example.com/user/$user$request_uri;
@buithaibinh
buithaibinh / transformer.ts
Created November 1, 2019 05:07
reading a packaged file in aws lambda package
import {readdirSync} from "fs";
/**
* src
* - handler.ts
* templates
*/
export const handler = (path: string = "templates") => {
var taskRoot = process.env["LAMBDA_TASK_ROOT"] || __dirname;
const fromDir = `${taskRoot}/${path}`;
const files = readdirSync(fromDir);
@buithaibinh
buithaibinh / rds.yml
Created December 4, 2019 06:38
aws aurora cloudformation
Parameters:
DatabaseName:
Type: String
Default: ${self:custom.secrets.dbName}
EngineVersion:
Type: String
Default: "5.6"
Conditions:
IsProd:
Fn::Equals:
@buithaibinh
buithaibinh / git-pushing-multiple.rst
Created December 12, 2019 11:25 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@buithaibinh
buithaibinh / schema.graphql
Created December 17, 2019 10:55 — forked from dabit3/schema.graphql
17 Access Patterns with GraphQL and AWS Amplify
type Order @model
@key(name: "byCustomerByStatusByDate", fields: ["customerID", "status", "date"])
@key(name: "byCustomerByDate", fields: ["customerID", "date"])
@key(name: "byRepresentativebyDate", fields: ["accountRepresentativeID", "date"])
@key(name: "byProduct", fields: ["productID", "id"])
{
id: ID!
customerID: ID!
accountRepresentativeID: ID!
productID: ID!
@buithaibinh
buithaibinh / regex-japanese.txt
Created February 12, 2020 03:23 — forked from terrancesnyder/regex-japanese.txt
Regex for Japanese
Regex for matching ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna!
([一-龯])
Regex for matching Hirgana or Katakana
([ぁ-んァ-ン])
Regex for matching Non-Hirgana or Non-Katakana
([^ぁ-んァ-ン])
Regex for matching Hirgana or Katakana or basic punctuation (、。’)