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

Array<T>

Legend:

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

Array<T>.prototype.*:

  • concat(...items: Array): T[] 🔒 ES3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@patmaddox
patmaddox / authorized_controller.rb
Created August 13, 2014 04:20
RubySteps 012 - Rails - Mini frameworks snippet
module AuthorizedController
# ... full code in the paid lesson
def show
resource = resource_by_id
if resource.viewable_by?(current_user)
render json: resource
else
render text: 'Unauthorized', status: :unauthorized
@patmaddox
patmaddox / rubysteps.rb
Created August 8, 2014 01:54
RubySteps 009 - OOP - Easty OOP (excerpt)
class StarWrapper
def initialize(stream)
@stream = stream
end
def puts(string)
print_header_line string
@stream.print "* "
@stream.print string
@stream.puts " *"
@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)
# 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 / 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

@ejholmes
ejholmes / Gemfile
Created November 10, 2012 20:04
Sample Force.com Sinatra app.
source :rubygems
gem 'sinatra', '~> 1.3.3'
gem 'json', '~> 1.7.5'
gem 'restforce', '~> 1.0.5'
gem 'thin', '~> 1.5.0'
group :development do
gem 'shotgun', '~> 0.9'
gem 'tunnels', '~> 1.2.2'
@matthewcopeland
matthewcopeland / deploy.rb
Created September 29, 2012 07:09
Example capistrano deploy.rb, based on Ryan Bates' example http://railscasts.com/episodes/335-deploying-to-a-vps
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"