This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run | |
set appName to "YOUR APP NAME" | |
if application appName is running then | |
tell application appName to quit | |
end if | |
if application appName is not running then | |
tell application appName to activate | |
end if |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# remap prefix from 'C-b' to 'C-a' | |
unbind C-b | |
set-option -g prefix C-a | |
bind-key C-a send-prefix | |
# Enable mouse control (clickable windows, panes, resizable panes) | |
set -g mouse on | |
# split panes using | and - | |
bind | split-window -h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Allow the iOS simulator to be entered in full screen | |
defaults write com.apple.iphonesimulator AllowFullscreenMode -bool YES | |
# Increase the auto hide timer for it to never show | |
defaults write com.apple.dock autohide-delay -float 10; killall Dock | |
# Change the length of the dock animation | |
defaults write com.apple.dock autohide-time-modifier -float 0.25;killall Dock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MongoClient = require('mongodb').MongoClient; | |
const url = process.env.MONGODB_URI || 'mongodb://localhost:27017/'; | |
let database: any = null; | |
export const MongoService = { | |
connect: () => new Promise((resolve: any) => { | |
MongoClient.connect(url, { useUnifiedTopology: true }, async (error: Error, db: any) => { | |
if (error) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import nodemailer from 'nodemailer'; | |
export const EmailService = { | |
send: async (subject: string, to: string, body: string) => { | |
const transporter = nodemailer.createTransport({ | |
host: 'smtp.gmail.com', | |
port: 587, | |
secure: false, | |
auth: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Preferences | |
export ZSH="/Users/olafkotur/.oh-my-zsh" | |
# Plugins | |
ZSH_THEME="olafkotur" | |
plugins=(git tmux) | |
source $ZSH/oh-my-zsh.sh | |
# Alias: Directories | |
alias dev="cd && cd ~/Development" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const data: ILiveData[] = await <any>MongoService.findOne('live', {}); | |
findOne: async (collection: string, query: any) => { | |
return new Promise((resolve: any) => { | |
database.collection(collection).findOne(query, (error: Error, res: any) => { | |
if (error) { | |
throw error; | |
} | |
resolve(res); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Removing: If you already know the index | |
someArray = append(someArray[:i], someArray[i+1:]...) | |
// Optional to remove multiple based on value | |
for i, value := range someArray { | |
if value == someOtherValue { | |
someArray = append(someArray[:i], someArray[i+1:]...) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JSON | |
type SomeData struct { | |
Id int `json:"id"` | |
Status string `json:"status"` | |
} | |
var data []SomeData | |
data = append(data, SomeData{1, "Hello World"}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "github.com/gorilla/mux" | |
// Setup and create handlers | |
router := mux.NewRouter().StrictSlash(true) | |
router.HandleFunc("/api/example", getExample).Methods("GET") | |
// Able to set up a function to execute before each request | |
_ = http.ListenAndServe(":"+port, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | |
// Do something here | |
router.ServeHTTP(w, r) |
OlderNewer