Skip to content

Instantly share code, notes, and snippets.

View bbg's full-sized avatar
👍
"Our true mentor in life is science."   Mustafa Kemal Atatürk

Batuhan Göksu bbg

👍
"Our true mentor in life is science."   Mustafa Kemal Atatürk
View GitHub Profile
@bbg
bbg / app.js
Created December 28, 2017 12:39 — forked from sogko/app.js
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
@bbg
bbg / setting-up-babel-nodemon.md
Created March 17, 2018 22:52 — forked from sam-artuso/setting-up-babel-nodemon.md
Setting up Babel and nodemon

Setting up Babel and nodemon

Inital set-up

Set up project:

mkdir project
cd project
npm init -y
@bbg
bbg / sublime-text-macos-context-menu.md
Created March 18, 2018 18:09 — forked from idleberg/sublime-text-macos-context-menu.md
“Open in Sublime Text” in macOS context-menu

Open in Sublime Text

  • Open Automator
  • Create a new Service
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
  • Set the script action to /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n "$@"
  • Set “Pass input” to as arguments
  • Save as Open in Sublime Text
@bbg
bbg / index.js
Created March 20, 2018 11:45
nodejs dir to json
var fs = require('fs');
var path = require('path');
var diretoryTreeToObj = function(dir, done) {
var results = [];
fs.readdir(dir, function(err, list) {
if (err)
return done(err);
@bbg
bbg / Makefile
Created April 1, 2018 10:37
Makefile for Go Projects
GOPATH=$(shell pwd)/vendor:$(shell pwd)
GOBIN=$(shell pwd)/bin
GOFILES=$(wildcard *.go)
GONAME=$(shell basename "$(PWD)")
PID=/tmp/go-$(GONAME).pid
build:
@echo "Building $(GOFILES) to ./bin"
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go build -o bin/$(GONAME) $(GOFILES)
@bbg
bbg / dropdown.js
Created April 8, 2018 07:46 — forked from blakehaswell/dropdown.js
Vanilla JS Dropdown
/**
* Given a list of items, adds and removes an active class as you hover over
* them. Used to create a dropdown menu.
*
* Copyright (c) 2012 Blake Haswell
* Licensed under the MIT license: http://opensource.org/licenses/MIT
*
* Example:
* var items = document.getElementById("dropdown").children;
* new Dropdown(items);
@bbg
bbg / build.gradle
Last active April 19, 2018 11:32
moses
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
}
}
}
}
@bbg
bbg / filex.cr
Created May 26, 2018 21:07
Some Crystal File add-ons
module FileX
def self.mount?(path)
begin
stat_path = File.lstat(path)
rescue Errno
# It doesn't exist so not a mount point
return false
end
# A symlink can never be a mount point
@bbg
bbg / app.cr
Created June 10, 2018 12:48 — forked from cjgajard/app.cr
Kemal controllers pattern
# src/{{app_name}}.cr
require "kemal"
require "./controllers/*"
alias Env = HTTP::Server::Context # this could be provided by Kemal
module Main
get "/", &->index(Env)
get "/:name", &->greet(Env)
end
@bbg
bbg / main.go
Created June 16, 2018 10:39 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"