Skip to content

Instantly share code, notes, and snippets.

@saifabid
saifabid / 0_reuse_code.js
Created November 25, 2015 15:40
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
@saifabid
saifabid / undo-merge
Created November 30, 2015 18:55
Undo a merge
git reset --merge ORIG_HEAD
git branch fixing-things HEAD@{1}
git reset fixing-things
@saifabid
saifabid / datadog.go
Last active May 24, 2016 22:21
Test s3 uploads -pub
package datadog
import (
"fmt"
"time"
"github.com/ooyala/go-dogstatsd"
)
// Statsd wraps the datadog interface
@saifabid
saifabid / feature_scale.py
Created May 30, 2016 03:35
simple feature scaling
def featureScaling(arr):
scaled_arr = []
max_val = max(arr)
min_val = min(arr)
if max_val == min_val:
return arr
denom = max_val - min_val
for val in arr:
new_val = float((val - min_val))/denom
@saifabid
saifabid / Ruby_Rails_Naming_Conventions.md
Created September 23, 2016 00:58 — forked from alexpchin/Ruby_Rails_Naming_Conventions.md
Ruby & Rails Naming Conventions

Alex's Rails Cheat Sheet

I think the most confusing thing that I have found about Ruby on Rails so far has been the transition from (trying to) write code myself to the use of the fabled "Rails Magic". So, to help my own understanding of a few core Ruby on Rails concepts, I have decided to write something on what I think is a CRITICAL topic... the idea of Convention over Configuration and why (in my mind) it is the most important thing that helps Rails become magic!

(This may be a topic that we cover in more detail in class but as I said, I'm writing this for my own understanding... I hope it helps someone else understand things too... Perhaps you can give me a hand when I'm crying next week!)

##Convention over configuration ###What does this "actually" mean...

@saifabid
saifabid / main.go
Created December 25, 2016 06:58
[golang] Current Time in Canada/Eastern
func currentTime() string {
loc, _ := time.LoadLocation("Canada/Eastern")
return time.Now().In(loc).Format(time.Kitchen)
}

Keybase proof

I hereby claim:

  • I am saifabid on github.
  • I am saifabid (https://keybase.io/saifabid) on keybase.
  • I have a public key ASCQ0Isj6chDIoNd-qRb3AXOx_FEOOrL50fe1SnRYybJigo

To claim this, I am signing this object:

@saifabid
saifabid / Dockerfile
Last active April 14, 2018 20:40
A simple dockerfile to get go program built and running.
FROM golang:1.9
# This is only so you can store it a proper go workspace layout
ENV dirPath $GOPATH/src/github.com/username/repo
RUN mkdir -p $dirPath
ADD . $dirPath
WORKDIR $dirPath
EXPOSE 3000
@saifabid
saifabid / docker-compose.yaml
Created April 14, 2018 20:48
A simple docker-compose file to get a go service running
version: '3'
services:
twitterhelp:
build:
context: .
image: twitterhelp:latest
ports:
- 3000:3000