Skip to content

Instantly share code, notes, and snippets.

View titanium-cranium's full-sized avatar

Brendan O'Brien titanium-cranium

View GitHub Profile
@titanium-cranium
titanium-cranium / psql_useful_stat_queries.sql
Created January 6, 2020 06:15 — forked from anvk/psql_useful_stat_queries.sql
List of some useful Stat Queries for PSQL
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables
@titanium-cranium
titanium-cranium / keybase.md
Created September 3, 2019 23:46
Keybase verification

Keybase proof

I hereby claim:

  • I am titanium-cranium on github.
  • I am titaniumcranium (https://keybase.io/titaniumcranium) on keybase.
  • I have a public key ASCNk17EHHaVmuOHQJR1vlktiMMVOWk7lgAjpdicv_rv4Qo

To claim this, I am signing this object:

@titanium-cranium
titanium-cranium / rbenv-commands.md
Last active August 16, 2019 02:31
rbenv quickreference

I got tired of looking this up so decided to just make a quick reference.

Please note these commands are being used in bash running on macOS

rbenv & rubybuild installed with homebrew

Upgrade list of ruby versions

brew upgrade rbenv ruby-build

List all available versions

rbenv install -l

@titanium-cranium
titanium-cranium / curl.md
Created February 22, 2019 01:48 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@titanium-cranium
titanium-cranium / linked_list_mutation.rb
Created November 14, 2017 21:17
Reverse a linked list with mutation
# This linked list reversal does not involve a stack, it simply
#creates a new set of nodes that point the opposite direction.
class LinkedListNode
attr_accessor :value, :next_node
def initialize(value, next_node=nil)
@value = value
@next_node = next_node
end
@titanium-cranium
titanium-cranium / recursive_fibonacci.rb
Created November 14, 2017 21:03
Recursive version returning the value of an element in the fibonacci series
def fib(n)
return n if (0..1).include? n
fib(n-1) + fib(n-2) if n > 1
end
puts fib(7)
@titanium-cranium
titanium-cranium / linked_list_stack.rb
Created November 14, 2017 21:00
Reverse a linked list using a stack
# linked_list reversal using a stack
class LinkedListNode
attr_accessor :value, :next_node
def initialize(value, next_node = nil)
@value = value
@next_node = next_node
end
@titanium-cranium
titanium-cranium / iterative_fibonacci.rb
Created November 14, 2017 20:58
Iterative version of returning the value of in a fibonacci series
def iter_fibonacci(num)
if num == 0
puts "fib(#{num}) = 0" and return
elsif num == 1
puts "fib(#{num}) = 1" and return
else
series = [0,1]
i = 2
while i <= num
result = series[i-2] + series[i-1]
@titanium-cranium
titanium-cranium / binary_tree_search_sort.rb
Created November 14, 2017 20:51
Ruby code for binary tree search and sort
class BTreeNode
attr_accessor :payload, :left, :right
def initialize(payload, left=nil, right=nil)
@payload = payload
@left = left
@right = right
end
end
@titanium-cranium
titanium-cranium / HelloWorld-props.jsx
Last active September 15, 2017 04:16
Learning React- HelloWorld-props
var Hello = React.createClass({
render: function(){
return (
<div>
<p>Hello {this.props.name}</p>
</div>
)
}
});