Skip to content

Instantly share code, notes, and snippets.

View inancgumus's full-sized avatar

İnanç Gümüş inancgumus

View GitHub Profile
@inancgumus
inancgumus / main.go
Last active July 5, 2017 11:46
Golang decorator pattern
package main
import (
"fmt"
)
type displayFunc func(s string)
func decorate(f displayFunc) displayFunc {
return func(s string) {
@inancgumus
inancgumus / mongoDao
Created June 16, 2017 11:32 — forked from jameBoy/mongoDao
封装一个mgo的简单使用
package dao
import (
"gopkg.in/mgo.v2/bson"
"time"
"gopkg.in/mgo.v2"
"strings"
"log"
)
@inancgumus
inancgumus / mgoTestExample
Created June 16, 2017 11:31 — forked from laeshiny/mgoTestExample.go
mgo test example
package main
import (
"fmt"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
"time"
)
type Content struct {
@inancgumus
inancgumus / serializejson.go
Created June 6, 2017 12:23
Serialize (Marshall) JSON into a writable stream
package main
import (
"bufio"
"encoding/json"
"fmt"
"os"
)
func main() {
@inancgumus
inancgumus / exercise_18_slices_pic_show.go
Last active August 23, 2023 10:58
go tour exercise solutions
package main
import "golang.org/x/tour/pic"
func Pic(dx, dy int) [][]uint8 {
p := make([][]uint8, dy)
for y := range p {
p[y] = make([]uint8, dx)
for x := 0; x < dx; x++ {
p[y][x] = uint8(x^y)
@inancgumus
inancgumus / xmlToJson.xslt
Created May 16, 2017 10:20
XML to JSON using XSLT
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="utf-8"/>
<xsl:template match="/*[node()]">
<xsl:text>{</xsl:text>
<xsl:apply-templates select="." mode="detect" />
<xsl:text>}</xsl:text>
</xsl:template>
@inancgumus
inancgumus / installing-react-vr.sh
Last active March 21, 2017 11:52
downloads, installs and opens the sample page
#
# run me by typing this:
#
# bash <(curl -s https://gist.githubusercontent.com/inancgumus/478ac54e68091cfdc2a088ceece21a66/raw/4220d45c3e9c15bbabc596c0d086b32be3416cbe/installing-react-vr.sh)
#
curl https://s3.amazonaws.com/static.oculus.com/reactvr/React_VR_Prerelease.zip
unzip React_VR_Prerelease.zip && mv preview react-vr && rm -f React_VR_Prerelease.zip
#!/usr/bin/env bash
#Code adapted from https://gist.github.com/yangj1e/3641843c758201ebbc6c (Modified to Python3.5)
cd ~
#wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda2-2.4.0-Linux-x86_64.sh
wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda3-2.4.1-Linux-x86_64.sh
bash Anaconda3-2.4.1-Linux-x86_64.sh -b
echo 'PATH="/home/ubuntu/anaconda3/bin:$PATH"' >> .bashrc
. .bashrc
@inancgumus
inancgumus / # postgresql - 2016-12-08_20-57-24.txt
Created December 8, 2016 18:04
postgresql on macOS 10.12.1 - Homebrew build logs
Homebrew build logs for postgresql on macOS 10.12.1
Build date: 2016-12-08 20:57:24
@inancgumus
inancgumus / index.html
Last active August 26, 2016 23:56 — forked from anonymous/index.html
d3 scatterplot experiment // source http://jsbin.com/zizunel
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>d3 starter kit</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.2/d3.js"></script>
<style id="jsbin-css">
/* Styles go here */