Skip to content

Instantly share code, notes, and snippets.

@jewsroch
jewsroch / d3-jquery-starter.markdown
Created November 10, 2017 19:17
D3 jQuery starter
@jewsroch
jewsroch / .block
Created June 4, 2017 16:01
fresh block
license: mit
@jewsroch
jewsroch / dynamic_programing.js
Created October 14, 2015 05:29
Dynamic Programing Problem
var a = [1,5,-5,2,-4, -6, 0, 2, 6];
var maxSub = function(a) {
var subSums = [];
// Create new array with largest subarray value of first
subSums[0] = Math.max(a[0], 0);
// Iterate through the array and create the new subproblems array for each value in the original.
<script type='text/javascript'>
window.parent.onbeforeunload = function() {
return "Don't Close";
};
</script>
<h1>Test closing.</h1>
@jewsroch
jewsroch / largest_tables.sql
Last active August 29, 2015 14:21
Largest Tables in Mysql
-- Select largest 20 from specific table
SELECT table_name AS "Tables", round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "{TABLE NAME}"
ORDER BY (data_length + index_length)
DESC
LIMIT 20;
-- Select largest from ALL tables

This is an adaptation of https://twitter.com/jasonneylon script.

In the terminal window, you can open your current repo (at the current branch) in your default browser.

My adaptation was adding options to view the commits, branches, pull requests or issues for the repo using one of the additional options (added support for wiki, settings, pulse, graphs, network):

[h]               => View help
[c]               => View commits
[c {SHA}]         => View specific commit from commit SHA

[b] => View branches

@jewsroch
jewsroch / centos.md
Last active August 29, 2015 14:09
CentOS Digital Ocean Setup

##LEMP (CentOS) Stack Setup on Digital Ocean These steps can be used to create a CentOS based droplet on Digital Ocean.
Source: Digital Ocean Guide

###Droplet, Users, SSH

  1. Create new droplet (without ssh key)
  2. SSH into the server with root@[ip] and the password that’s emailed.
  3. Change the root password and save in 1pass.
  4. Create new user: adduser demo
  5. Change new user’s pw: passed demo then save in 1pass
@jewsroch
jewsroch / index.md
Last active August 29, 2015 14:06 — forked from rstacruz/index.md

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@jewsroch
jewsroch / osx_setup.md
Created August 21, 2014 21:49 — forked from andrewvaughan/osx_setup.md
Steps for setting up a new Mac

Mac OSX Bootstrap

Upgrade to Mavericks

  1. Install Mavericks via the App Store.

Secure The Machine