Skip to content

Instantly share code, notes, and snippets.

💭
Coding, of course...

Noel Martin Llevares dashmug

💭
Coding, of course...
Block or report user

Report or block dashmug

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View sample.js
// Main API Lambda
async function (event) {
let input
let context
let response
try {
// input is simply the relevant input (not the whole
// AWS Lambda event which contains lots of unnecessary data)
View sample.js
// Don't
function handler(event, context) {
const s3 = new AWS.S3()
return s3.upload({}).promise()
}
// Better - Init variables outside the handler
const s3 = new AWS.S3()
View inventory.js
class InventoryObject {
/**
* @param {string} name
* @param {number} price
*/
constructor(name, price) {
this.name = name;
this.price = price;
}
@dashmug
dashmug / inner-vs-outer-functions.js
Created Jan 23, 2017
Which is better inner or outer functions?
View inner-vs-outer-functions.js
const oneBigFunction = () => {
const add = (x, y) => x + y
const subtract = (x, y) => x - y
const multiply = (x, y) => x * y
const divide = (x, y) => x / y
return divide(add(multiply(8, 1), 2), subtract(3, 1))
}
// or
View prompt_dashmug_setup
#
# A simple theme that displays relevant, contextual information.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Screenshots:
# http://i.imgur.com/nrGV6pg.png
#
View django_dev_server.sh
apt-get install python-software-properties
add-apt-repository ppa:keithw/mosh
apt-get update && apt-get upgrade -y
apt-get install -y \
python-dev \
python3-dev \
build-essential \
git \
@dashmug
dashmug / update_toolset.sh
Last active Aug 29, 2015
a simple script I use for updating my Homebrew, composer, pip, npm, and gem packages
View update_toolset.sh
set -e
set -x
sudo aptitude update
sudo aptitude upgrade -y
for package in $(npm -g outdated --parseable --depth=0 | cut -d: -f2)
do
sudo npm -g install "$package"
@dashmug
dashmug / dashmug.zsh-theme
Created Jun 2, 2014
My custom oh-my-zsh theme. Place inside custom.
View dashmug.zsh-theme
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%} git:"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}⚡"
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_HG_PROMPT_PREFIX="%{$fg[green]%} hg:"
ZSH_THEME_HG_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_HG_PROMPT_DIRTY=" %{$fg[red]%}⚡"
ZSH_THEME_HG_PROMPT_CLEAN=""
@dashmug
dashmug / osx_tools.md
Last active Aug 29, 2015
Essential tools I need when working on OS X
View osx_tools.md

Essential Apps

  • SublimeText
  • Skype
  • Chrome
  • Firefox
  • Alfred
  • iTerm
  • Clipmenu
  • SizeUp
@dashmug
dashmug / .nanorc
Created Jun 1, 2014
Nano configuration
View .nanorc
set autoindent
set const
set fill 80
unset nonewlines
set smooth
set tabsize 4
set tabstospaces
set smarthome
include ~/.nano/apacheconf.nanorc
You can’t perform that action at this time.