Skip to content

Instantly share code, notes, and snippets.

View Mistat's full-sized avatar

Misato Mistat

  • Tailor
  • Tokyo
View GitHub Profile
machine:
php:
version: 7.0.7
timezone:
Asia/Tokyo
dependencies:
post:
- sudo service postgresql stop
- sudo service mongod stop
## https://forums.aws.amazon.com/message.jspa?messageID=675886
## convert HTML FORM POST data to JSON for insertion directly into a Lambda function
## get the raw post data from the AWS built-in variable and give it a nicer name
#set($rawPostData = $input.path('$'))
## first we get the number of "&" in the string, this tells us if there is more than one key value pair
#set($countAmpersands = $rawPostData.length() - $rawPostData.replace("&", "").length())
## if there are no "&" at all then we have only one key value pair.
@Mistat
Mistat / Gruntfile.js
Created August 5, 2015 10:08
Titanium + Babel + Alloy
var path = require('path');
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
babel: {
options: {
sourceMap: true,
stage: 0
@Mistat
Mistat / web.config
Last active August 29, 2015 14:19
EntityFramework 6 + Npgsql
<entityFramework>
<defaultConnectionFactory type="Npgsql.NpgsqlConnectionFactory, Npgsql.EntityFramework" />
<providers>
<provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, Npgsql.EntityFramework" />
</providers>
</entityFramework>
// Get AccessToken and AccessTokenSecret
app.get('/call', function(req, res) {
var accessToken = req.session.passport.user.token;
var accessTokenSecret = req.session.passport.user.tokenSecret;
// any code ....
}
// Example request
@Mistat
Mistat / gist:3431193
Created August 23, 2012 01:48
pyramid test case sample
# -*- coding: utf-8 -*-
import sys
import unittest
import pyramid.threadlocal
import pyramid.testing
import pyramid.paster
import sqlalchemy
@Mistat
Mistat / 設定.txt
Created July 21, 2012 04:33
MaxOSX PostgreSQLのLaunchCtlの設定
□設定ファイル
$ vim ~/Library/LaunchAgents/org.postgresql.postgres.plist
https://gist.github.com/3154582 の内容を記載
□起動
$ launchctl start org.postgresql.postgres
@Mistat
Mistat / postgresql.postgres.plist
Created July 21, 2012 04:32
PostgreSQL LaunchAgentFIle
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>org.postgresql.postgres</string>
<key>ProgramArguments</key>
<array>
@Mistat
Mistat / rms_books.php
Created February 27, 2012 06:43
Rakuten Web service books search smapo
<?php
$doc = simplexml_load_file('http://api.rakuten.co.jp/rws/3.0/rest?developerId=12657057e6e263dfe5dd57b5565078da&operation=BooksCDSearch&version=2011-12-01&artistName=AI');
$doc->registerXPathNamespace('booksCDSearch', 'http://api.rakuten.co.jp/rws/rest/BooksCDSearch/2011-12-01');
foreach ($doc->xpath('Body/booksCDSearch:BooksCDSearch/Items/Item') as $item) {
echo $item->title, "\n";
}
@Mistat
Mistat / attachment_mail.sh
Created February 5, 2012 13:49
Mail Attachment sample
#!/bin/bash
# vim: enc=utf8:
CMD_SENDMAIL=/usr/sbin/sendmail
CMD_UUENC=/usr/bin/uuencode
CMD_NKF=/usr/local/bin/nkf
ATTACHMENT_FILE=test.jpg
BOUNDARY=`date +%Y%m%d%H%M%N`