Skip to content

Instantly share code, notes, and snippets.

View 178inaba's full-sized avatar
🤔
hello, world

Masahiro Furudate 178inaba

🤔
hello, world
View GitHub Profile
@178inaba
178inaba / main.go
Created November 23, 2016 06:33
Print header with golang.
package main
import (
"net/http"
log "github.com/Sirupsen/logrus"
"github.com/gin-gonic/gin"
)
func main() {
FROM alpine
COPY tz .
CMD ["sh"]
@178inaba
178inaba / division.go
Created September 23, 2016 15:34
Trial golang benchmark.
package division
// Division is ...
func Division(n float64) float64 {
return n / 10
}
// Multiplication is ...
func Multiplication(n float64) float64 {
return n * 0.1
@178inaba
178inaba / main.go
Last active November 22, 2016 18:02
Web site title getter. Using goquery.
package main
import (
"errors"
"fmt"
"net/http"
"time"
"github.com/PuerkitoBio/goquery"
log "github.com/Sirupsen/logrus"
@178inaba
178inaba / msgpack.go
Created September 3, 2016 19:25
MessagePack in go.
package main
import (
"fmt"
"github.com/ugorji/go/codec"
)
func main() {
material := "onion potato carrot"
@178inaba
178inaba / file0.coffee
Last active August 19, 2016 01:04
古いnode.js(0.10.x)でMoment.jsのプラグインとMoment Timezoneを共存させる方法 ref: http://qiita.com/178inaba/items/4ac5161b1a6be9055df0
moment = require 'moment-timezone'
require 'moment-round'
# ...
getFilename = ->
moment()
.tz('Asia/Tokyo')
.floor(5, 'minutes')
# ^ <- ここ
@178inaba
178inaba / imgur-delete.coffee
Last active August 20, 2016 15:33
imgur upload image delete script.
# Script to delete the image of imgur.
#
# client id - Client ID of imgur.
# delete hash - Delete hash of the uploaded image to imgur.
#
# Preparation
#
# Install dependencies package:
# $ npm install request
#
@178inaba
178inaba / sgml-mode-patch.el
Last active June 19, 2016 06:00
jsx attribute indentation for emacs js2-jsx-mode. (https://github.com/mooz/js2-mode/issues/291)
;; Patch 24.5's `sgml-mode' with the new attribute offset feature.
(with-eval-after-load 'sgml-mode
(defcustom sgml-attribute-offset 0
"Specifies a delta for attribute indentation in `sgml-indent-line'.
When 0, attribute indentation looks like this:
<element
attribute=\"value\">
@178inaba
178inaba / memcache-d.php
Last active July 10, 2016 15:56
memcache and memcached can be use check.
<?php
$m = null;
if (extension_loaded('memcached')) {
echo "use memcached.\n";
$m = new Memcached();
} elseif (extension_loaded('memcache')) {
echo "use memcache.\n";
$m = new Memcache();
} else {
echo "memcache and memcached is not installed.\n";
@178inaba
178inaba / get_toml.php
Last active June 2, 2016 03:09
get toml value for zf1
<?php
use Yosymfony\Toml\Toml;
if (! function_exists('toml')) {
function toml($key = null)
{
$toml = [];
$paths = glob('../application/configs/toml/*.toml');
foreach ($paths as $path) {