Skip to content

Instantly share code, notes, and snippets.

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
require 'yaml'
require '../lesson2/helper_methods.rb'
require './ttt_computer_methods.rb'
CROSS = 'X'.freeze
NOUGHT = 'O'.freeze
FIRST_PLAYER = 'choose'.freeze
EMPTY_POSITION = ' '.freeze
ALTENATE_PLAYERS = { 'X' => NOUGHT, 'O' => CROSS }.freeze
PLAYERS = { 'O' => 'Computer', 'X' => 'You' }.freeze
@mwakipesile
mwakipesile / home.js
Created July 28, 2016 01:30 — forked from ecto/home.js
The home page for our FaceMash clone
app.get('/', function(req, res){
db.keys('image:*:location', function(err,keys){
if (err) { throw err; }
var offense = keys[Math.floor(Math.random()*keys.length)];
var defense = keys[Math.floor(Math.random()*keys.length)];
if (defense == offense) {
defense = keys[Math.floor(Math.random()*keys.length)];
}
db.mget('image:' + offense + ':location', 'image:' + offense + ':rating',
'image:' + defense + ':location', 'image:' + defense + ':rating',

Keybase proof

I hereby claim:

  • I am mwakipesile on github.
  • I am antigua (https://keybase.io/antigua) on keybase.
  • I have a public key whose fingerprint is 096F 50A7 92FF AB59 56D2 AC10 B177 FDD5 C77B A9B2

To claim this, I am signing this object:

Introduction to SQL and Postgres Cheatsheet

shell commands

Command Function
psql Interact with Postgres
... -d $name Connect to a database
createdb $name Create a database
dropdb $name Destroy a database
pg_dump Utility for backing up and restoring
@mwakipesile
mwakipesile / resources.md
Created December 9, 2016 18:04 — forked from andycandrea/resources.md
A list of resources for learning Rails and relevant technologies

A list of resources that aspiring Rails developers can use to learn Rails and other relevant technologies. This list includes some resources that I see recommended all over the web--not all of which I like--as well as some hidden gems that I've found valuable. This list is intended to supplement my blog post here.

Ruby

  • Codecademy
    • One of the more well-known sites to offer interactive programming tutorials, Codecademy is probably best utilized by those who are pretty new to programming, though the Ruby tutorial is good for teaching Ruby syntax and eventually gets into some less trivial material.
  • Try Ruby
  • Pretty similar to Codecademy. Once again, it's beginner-friendly, though, as someone who knew about object-oriented programming beforehand, I found it somewhat annoying to use, as there's no page with links to the individual exercises (at le
<!doctype html>
<html lang="en-US">
<head>
<title>M. Edgar Joel</title>
<meta charset="UTF-8" />
</head>
<body>
<h1>M. Edgar Joel</h1>
https://github.com/mwakipesile
@mwakipesile
mwakipesile / howto-manually-add-trust-cert-to-rubygems.md
Created December 22, 2016 23:35
Workaround RubyGems' SSL errors on Ruby for Windows (RubyInstaller)

SSL upgrades on rubygems.org and RubyInstaller versions

UPDATE 2016-12-01: Please refer to the official guide instead of this process.

UPDATE 2014-12-21: RubyGems 1.8.30, 2.0.15 and 2.2.3 have been released. It requires manual installation, please see instructions below.


Hello,

// Second argument's omitted, default to factors [3, 5]
console.log(sumOfMultiples(10)) // returns 23
console.log(sumOfMultiples(100)) // returns 2318
console.log(sumOfMultiples(1000)) // returns 233168
// Limit is smaller than all factors (3, 5)
console.log(sumOfMultiples(1)) // returns 0
// Limit is smaller than some factor(s)
console.log(sumOfMultiples(4)) // returns 3
function sumOfMultiples(limit, factors = [3, 5]) {
var multiple;
var multiples = [];
//TODO: Validate inputs
var collectFactorsUniqueMultiples = function(factor) {
multiple = factor;
while (multiple < limit) {