Skip to content

Instantly share code, notes, and snippets.

View erhangundogan's full-sized avatar
👋

Erhan Gundogan erhangundogan

👋
View GitHub Profile
var a = [1,2,3,4,5,6,7,8,9,10];
console.time('testing_forward');
for (var i = 0; i < a.length; i++);
console.timeEnd('testing_forward');
// output: testing_forward: 0.041ms
console.time('testing_backwards');
for (var i = a.length - 1; i >= 0; i--);
console.timeEnd('testing_backwards');
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>d3 js beginning</title>
<style>
.pos {
position:absolute;
font-size:48pt;
position: absolute;
@erhangundogan
erhangundogan / calculator
Created February 11, 2014 08:05
raw calculator
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style>
input[type=button] {
width: 40px;
height: 40px;
margin: 5px;
// Load required modules
var http = require("http"); // http server core module
var express = require("express"); // web framework external module
var io = require("socket.io"); // web socket external module
var easyrtc = require("easyrtc"); // EasyRTC external module
// Setup and configure Express http server. Expect a subfolder called "static" to be the web root.
@erhangundogan
erhangundogan / seq.go
Created July 17, 2014 08:10
simple go http server
package main
import (
"fmt"
"net/http"
"strings"
)
var chttp = http.NewServeMux()

val: constant (preferred) var: variable

if conditions

if .. else .. return type specified according to topmost type of if/else return types

tuples

<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="http://d3js.org/d3.v3.min.js"></script>
<style>
.bar {
fill: steelblue;
}
.axis text {
@erhangundogan
erhangundogan / loopback.md
Last active August 29, 2015 14:14
loopback usage

loopback.io directory structure

  • server - Node application scripts and configuration files.
  • client - Client JavaScript, HTML, and CSS files.
  • common - Files common to client and server. The /models sub-directory contains all model JSON and JavaScript files.

/server - Node files

  • server.js: Main application program file.
  • config.json: Application settings.
@erhangundogan
erhangundogan / heroku-ssl.md
Last active August 29, 2015 14:14
heroku ssl usage
heroku addons:add ssl:endpoint
openssl genrsa -out privatekey.pem 1024
openssl req -new -key privatekey.pem -out certrequest.csr
openssl x509 -req -in certrequest.csr -signkey privatekey.pem -out certificate.pem
heroku certs:add certificate.pem privatekey.pem 
@erhangundogan
erhangundogan / bignumber.js
Created August 11, 2015 21:36
Factorial and BigNumbers
var factorial = function(n) {
var res = [1];
var res_size = 1;
for (var x = 2; x <= n; x++) {
res_size = multiply(x, res, res_size);
}
return res.reverse();
};