This file contains 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
// Converted https://gist.github.com/shrugs/44cfb94faa7f09bcd9cb for ES6 | |
function scriptRunPromise() { | |
const gs = {}; | |
// google.script.run contains doSomething() methods at runtime. | |
// Object.keys(goog.sscript.run) returns array of method names. | |
const keys = Object.keys(google.script.run); | |
// for each key, i.e. method name... |
This file contains 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
<html> | |
<head> | |
<title>client</title> | |
<script type="text/javascript" src="jquery-1.7.2.js"></script> | |
<script type="text/javascript" src="jquery.base64.js"></script> | |
<script type="text/javascript"> | |
function getinfo() { | |
$.ajax({ | |
url: "http://example.com/", | |
success: function(data){alert('OK');}, |
This file contains 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
class DotDict(dict): | |
"""dict class that allows you to access values by dot notation""" | |
def __init__(self,arg): | |
for k in arg.keys(): | |
if (type(arg[k]) is dict): | |
self[k]=DotDict(arg[k]) | |
else: | |
self[k]=arg[k] | |
def __getattr__(self, attr): |
This file contains 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
// pages/api/hello.js | |
import CookieSession from 'cookie-session' | |
const cookieSession = CookieSession({ name: 'session', keys: ['foo', 'bar'] }) | |
function runMiddleware(req, res, fn) { | |
return new Promise((resolve, reject) => { | |
fn(req, res, result => { | |
if (result instanceof Error) { | |
return reject(result) |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Image Uploader</title> | |
</head> |
This file contains 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
# coding: utf8 | |
from flask import Flask | |
app = Flask(__name__) | |
@app.route('/') | |
def hello(): | |
return 'Hello World!' |
This file contains 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
from time import sleep | |
from threading import Event, Thread | |
def main(): | |
# set | |
to_run = Event() | |
to_run.set() | |
# start thread | |
worker = Worker(to_run, 1) |
This file contains 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
#!/bin/bash | |
# activate | |
cat << 'EOS' > activate | |
export GOPATH=$(pwd) | |
export PATH=${PATH}:$(pwd)/bin | |
EOS | |
# VS Code setting | |
mkdir -p .vscode |
This file contains 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
// 既定値を上書きするには、このファイル内にキー バインドを挿入します | |
[ | |
// Moving cursor | |
{ "key": "ctrl+p", "command": "cursorUp", | |
"when": "editorTextFocus" }, | |
{ "key": "ctrl+n", "command": "cursorDown", | |
"when": "editorTextFocus" }, | |
{ "key": "ctrl+f", "command": "cursorRight", | |
"when": "editorTextFocus"}, | |
{ "key": "ctrl+b", "command": "cursorLeft", |
This file contains 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 main | |
import ( | |
"fmt" | |
"math/rand" | |
) | |
func main() { | |
var p Point = Point{2, 3} | |
var q Quality = Quality{99.9} |
NewerOlder