Skip to content

Instantly share code, notes, and snippets.

View colmarius's full-sized avatar
💭
🎶 🎹

Marius Colacioiu colmarius

💭
🎶 🎹
View GitHub Profile
@colmarius
colmarius / stack_kata_steps.txt
Created March 5, 2015 12:42
Stack kata steps
# newly created stacks should be empty
# after one push stack size should be one
# after one push and one pop should be empty
# when pushed past limit stack overflows
# when empty stack popped should throw underflow
# when one is pushed one is popped
# when one and two are pushed two and one are popped
# when creating stack with negative size should throw illegal capacity
# when creating stack with zero capacity any push should overflow
# when one is pushed one is on top
@colmarius
colmarius / test_rotr.rb
Last active August 29, 2015 14:24
Solve rotr for hidden string
#!/usr/bin/env ruby
# Solved from https://docs.google.com/forms/d/1h6LtvCS3tVosk1-dbEsX54DsLxE6Xg9tTWUT2C-JqMk/viewform
hidden_string = 'bddpvout ejggfsfou gps qbttxpse b sfvtf opu Ep'
def rotr_word(word, number)
letters = word.split('')
.map do |letter|
(letter.ord + number).chr
@colmarius
colmarius / Setup-Dokku-on-Linode-Ubuntu-13.04
Last active September 8, 2015 04:26
Setup Dokku on Linode Ubuntu 13.04
# After building a new Linode Ubuntu 13.04 image...
ssh root@linode-123
# ...
uname -a
# Linux li348-235 3.12.9-x86_64-linode37 #1 SMP Mon Feb 3 10:01:02 EST 2014 x86_64 x86_64 x86_64 GNU/Linux
apt-get update
apt-get install -y linux-virtual grub-legacy-ec2
@colmarius
colmarius / keybase.md
Created April 5, 2016 11:27
keybase.md

Keybase proof

I hereby claim:

  • I am colmarius on github.
  • I am colmarius (https://keybase.io/colmarius) on keybase.
  • I have a public key whose fingerprint is F2A6 4700 5AB9 3F22 8E30 9F3D 1701 A84E 226C 57CF

To claim this, I am signing this object:

@colmarius
colmarius / Ephemeral.rb
Last active May 20, 2016 21:42
Playing with ephemeral gem
#
# Playing with ephemeral gem
#
# - https://github.com/CoralineAda/ephemeral/
class Base
include Ephemeral::Base
def initialize(args={}); args.each{|k,v| self.send("#{k}=", v)}; end
end
@colmarius
colmarius / PostgreSQL_Upgrade.md
Last active July 8, 2016 05:49
PostgreSQL Upgrade

Inspired by this tip

Example of upgrading PostgreSQL from 9.3 to latest 9.5

Stop running application and services

Create a database backup

Stop any running postgres instance

@colmarius
colmarius / redux-connect-todo-app-refactor.js
Last active January 19, 2017 10:45
Redux egghead.io course: refactor with connect to create containers which use presentational components
const todo = (state, action) => {
switch (action.type) {
case 'ADD_TODO':
return {
id: action.id,
text: action.text,
completed: false
};
case 'TOGGLE_TODO':
if (state.id !== action.id) {
@colmarius
colmarius / react-redux.md
Last active March 11, 2017 16:24
React / Redux workshop takeaways at Socrates CH

Starting with React / Redux workshop

React

  • create-react-app: React app generator, easiest way to start with React
  • [React Daily UI]: React implementations of daily UI challenges
  • Book [FullStack React]: practical tutorials + code examples, covers topics on React, Redux, Testing, GraphQL and more
@colmarius
colmarius / README.md
Created August 31, 2017 11:30 — forked from curran/README.md
The Iris Dataset

This is the "Iris" dataset. Originally published at UCI Machine Learning Repository: Iris Data Set, this small dataset from 1936 is often used for testing out machine learning algorithms and visualizations (for example, Scatter Plot). Each row of the table represents an iris flower, including its species and dimensions of its botanical parts, sepal and petal, in centimeters.

The HTML page provides the basic code required to load the data and display it on the page (as JSON) using D3.js.

Built with blockbuilder.org

web counter
@colmarius
colmarius / script_mongodump_mongorestore.sh
Last active March 1, 2018 18:42
Mongodump / Mongorestore example
##
## Prefer mongodump/mongorestore instead of mongoexport/mongoimport,
## as it will "export" additional metadata, like indexes etc.
##
### Mongodump example
# Required: host, db, collection, out
# Optional: query (limit results)
mongodump --host mongodb1.example.net \