Skip to content

Instantly share code, notes, and snippets.

View stephenbaidu's full-sized avatar
🏠
Working from home

Stephen Baidu stephenbaidu

🏠
Working from home
  • Microsoft
  • Redmond, WA
View GitHub Profile
Function SimpleContextMenu {
param (
[Parameter(Mandatory, Position = 0)]
[System.Object]
$List,
[Parameter(Mandatory = $false, Position = 1)]
[string]
$Header = "Select"
)
# Git Helpers
function _git_url {
return $(git config --get remote.origin.url)
}
function _git_root {
$gitDir = git rev-parse --git-dir
if ($null -eq $gitDir) {
return $null
# Git Helpers
function fn_git_branch { & git branch }
New-Alias -Name gb -Value fn_git_branch -Force -Option AllScope
function fn_git_checkout_master { & git checkout master }
New-Alias -Name master -Value fn_git_checkout_master -Force -Option AllScope
New-Alias -Name gb -Value fn_git_branch -Force -Option AllScope
function fn_git_checkout_main { & git checkout main }
New-Alias -Name main -Value fn_git_checkout_main -Force -Option AllScope
function fn_git_status { & git status }
New-Alias -Name gs -Value fn_git_status -Force -Option AllScope
Function SimpleContextMenu {
param (
[Parameter(Mandatory, Position = 0)]
[System.Object]
$List,
[Parameter(Mandatory = $false, Position = 1)]
[string]
$Header = "Select"
)
# ~/.bash_profile
# You can load both rvm and asdf in ~/.bash_profile
# This makes it easy to switch what to load
# RVM
# source $HOME/.rvm/scripts/rvm
# ASDF
. $HOME/.asdf/asdf.sh
//
// main.cpp
// SortingAlgorithms
//
// Created by Stephen Baidu on 9/8/14.
// Copyright (c) 2014 Stephen Baidu. All rights reserved.
//
#include <iostream>
#include <vector>
module Resourcify
extend ActiveSupport::Concern
included do
before_action :set_resource, only: [:show, :update, :destroy]
end
def index
@resources = resource_class.all
end
# ~/.railsrc
--database=postgresql
--skip-test-unit
--skip-turbolinks
--skip-spring
--skip-coffee
--skip-bundle
class FlattenArray
attr_reader :result
def initialize(array)
@array = array
end
def call
@result = flatten(@array) || []
@result
def flatten(element)
return [element] unless element.is_a?(Array)
element.map{|e| flatten(e) }.inject(:+)
end