Skip to content

Instantly share code, notes, and snippets.

View oddlyzen's full-sized avatar
:electron:
Working with Electron

Mark Coates oddlyzen

:electron:
Working with Electron
View GitHub Profile
### --- 04/18/18 | elementaryOS --- ###
alias gc='git commit -am'
alias lsd='ls -la'
alias gco='git co'
alias gs="git status"
# ls aliases
alias ll='ls -alF'
alias la='ls -A'

Array<T>

Legend:

  • ✏️ method changes this.
  • 🔒 method does not change this.

Array<T>.prototype.*:

  • concat(...items: Array): T[] 🔒 ES3
@oddlyzen
oddlyzen / base_model.rb
Created June 22, 2017 16:57
Quill - ActiveAdmin BaseModel Sub-class
class Quill::BaseModel
include ActiveModel::Model
attr_accessor :id, :access_token
def self.special_attrs *attrs
return @special_attrs unless attrs.any?
@special_attrs = attrs
end
def self.inherited subclass
@oddlyzen
oddlyzen / .bash_aliases
Last active April 8, 2018 02:49
Awesome aliases for your Linux Mint.
# ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias d="ls -G"
alias lsd="ls -lahG"
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
require "bundler/capistrano"
server "96.126.100.112", :web, :app, :db, primary: true
set :application, "capteste"
set :user, "deployer"
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false
set :port, "3030"
@oddlyzen
oddlyzen / deploy.rb
Created February 20, 2014 20:12 — forked from andrebras/deploy.rb
set :application, "sprai"
# RVM integration
# http://beginrescueend.com/integration/capistrano/
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_ruby_string, "1.9.2-p290"
set :rvm_type, :user
# Bundler integration (bundle install)
@oddlyzen
oddlyzen / toys.rb
Created February 13, 2014 18:21 — forked from lucapette/toys.rb
class Array
def self.toy(n=10, &block)
block_given? ? Array.new(n,&block) : Array.new(n) {|i| i+1}
end
end
class Hash
def self.toy(n=10)
Hash[Array.toy(n).zip(Array.toy(n){|c| (96+(c+1)).chr})]
end
# app/models/my_model.rb
module MyApp
module Model
def self.included(base)
base.send :include, Mongoid::Document
base.send :include, Mongoid::Timestamps
base.send :include, ActiveAdmin::Mongoid::Patches
end
end
@oddlyzen
oddlyzen / closures.rb
Created November 26, 2013 16:11
Experiments with Ruby Closures — Highlights differences, inconsistencies, and subtleties behind everyone's favorite little language construct.
# CLOSURES IN RUBY Paul Cantrell http://innig.net
# Email: username "cantrell", domain name "pobox.com"
# I recommend executing this file, then reading it alongside its output.
#
# Alteratively, you can give yourself a sort of Ruby test by deleting all the comments,
# then trying to guess the output of the code!
# A closure is a block of code which meets three criteria:
#
@oddlyzen
oddlyzen / devops_shell_commands.md
Last active March 25, 2019 08:17
A list of extremely useful DevOps commands for *nix environments (Use caution on OS X, of course...)

Process Basics

All processes, with params + hierarchy

ps auxww -H

Show all ruby-related PIDs and processes

pgrep -fl ruby