Skip to content

Instantly share code, notes, and snippets.

View hjr265's full-sized avatar
🕟
Half past four

Mahmud Ridwan hjr265

🕟
Half past four
View GitHub Profile
@hjr265
hjr265 / compress.go
Created May 27, 2014 09:24
Compress Handler
package main
import (
"compress/gzip"
"io"
"net/http"
"strings"
)
type GzipResponseWriter struct {
@hjr265
hjr265 / main.go
Created February 2, 2015 20:42
Using "gorilla/sessions"
package main
import (
"net/http"
"github.com/gorilla/mux"
"github.com/gorilla/sessions"
)
func main() {
@hjr265
hjr265 / RandomBot.js
Created March 17, 2015 10:34
RandomBot.js
function Bot() {
this.grid = []
for(var y = 0; y < 10; ++y) {
var row = []
for(var x = 0; x < 10; ++x) {
row.push({
attacked: false
})
}
this.grid.push(row)
@hjr265
hjr265 / nyan.js
Created March 27, 2015 07:00
Async.auto FTW
async.auto({
a: function() {},
b: ['a', function() {}],
c: ['b', function() {}],
d: ['c', function() {}],
e: ['d', function() {}]
////////
// This sample is published as part of the blog article at www.toptal.com/blog
// Visit www.toptal.com/blog and subscribe to our newsletter to read great posts
////////
@hjr265
hjr265 / dotenv.sh
Last active November 29, 2015 04:41
Reads each line from .env file in the current directory and exports key=value to environment
#!/bin/bash
name=${1:-.env}
while read -r line
do
line=`echo "$line" | sed -e 's/^ *//' -e 's/ *$//'`
if [[ X"" = X"$line" ]]
@hjr265
hjr265 / 0_reuse_code.js
Created December 13, 2015 18:45
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#include <iostream>
using namespace std;
int main() {
cout << "Hello, world!" << endl;
return 0;
}
package main
import "fmt"
func main() {
fmt.Println("Hello, world!")
}
console.log("Hello, world!");