Skip to content

Instantly share code, notes, and snippets.

@BukhariH
BukhariH / Merge Last Two Commits.sh
Created September 28, 2017 18:06
Merge Last Two Commits
git reset --soft "HEAD^"
git commit --amend
@BukhariH
BukhariH / uniqueProperties.js
Last active September 6, 2017 10:33
Get unique properties from JSON object
// Turn const ARRAY = [{type: "FOO", content: "Test 0"}, {type: "BAR", content: "Test 1"}, {type: "FOO", content: "Test 2"}]
// Into ["FOO", "BAR"]
// Using getUniqueProperties(ARRAY, 'type')
getUniqueProperties = (array, property)=>{
return [...new Set(array.map(elem => elem[property]))]
}
@BukhariH
BukhariH / reduceArrayToObj.js
Last active July 12, 2017 10:11
Turn an Array of Objects into an Object using Reduce
// change array & property to relevant values
const reducedObj = array.reduce(function(accum, item) {
accum[item.property] = item;
return accum;
}, {})
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
@BukhariH
BukhariH / iterm2-solarized.md
Created June 5, 2016 19:59 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + oh my zsh + solarized + Meslo powerline font (OSX)

Solarized

alias desktop='cd /Users/Hasnain/Desktop'
alias fs='foreman start'
alias fsdev='foreman start -f Procfile-dev'
alias bu='bundle update'
alias rs='rails s'
alias be='bundle exec'
alias gems='cd /Users/Hasnain/dev/gem'
alias web='cd /Users/Hasnain/dev/web'
alias tmp='cd /Users/Hasnain/dev/tmp'
alias nit='cd /Users/Hasnain/Nitrous'
require 'json'
require 'net/http'
require 'uri'
require 'rbconfig'
require 'io/console'
puts "Enter Username:"
@username = gets.chomp
puts "Enter Password (input will be hidden):"
@password = STDIN.noecho(&:gets).chomp
require 'json'
require 'net/http'
require 'uri'
require 'rbconfig'
require 'io/console'
puts "Enter Username:"
@username = gets.chomp
puts "Enter Password (input will be hidden):"
@password = STDIN.noecho(&:gets).chomp
@BukhariH
BukhariH / 4.3.1 Photosynthesis Pigments.md
Last active August 29, 2015 14:01
4.3.1 Photosynthesis Pigment
  • f) define the term photosynthetic pigment;

    • Photosynthetic pigments are molecules that absorb light energy.
    • Each pigment absorbs a specific wavelength of light in the visible light region
    • Each pigment also has specific peak of absorption
    • Wavelengths outside the range a reflected
    • This reflected light is the colour which they appear to us as
  • g) explain the importance of photosynthetic pigments in photosynthesis;

    • Photosynthetic Pigments are held in place by proteins in the thylakoid membranes
    • They are arranged in a funnel shape structure called a photosystem