Skip to content

Instantly share code, notes, and snippets.

View vdw's full-sized avatar

Dimitris Krestos vdw

View GitHub Profile
@vdw
vdw / gist:3748557
Last active October 10, 2015 20:48
Basic CSS shortner rules

Basic CSS shortner rules

1) Trim white spaces

2) Remove new lines (/n) ~> single line

3) Remove last semi-column (;)

4) Hexadecimal color:

  • #FFFFFF becomes #fff (color is case-insensitive)
@vdw
vdw / gist:5093828
Last active December 19, 2016 22:36
Install RVM on Ubuntu from scratch

Install RVM on Ubuntu 12 from scratch

Clean up

1) Run the following commands to remove rvm:
rvm implode
sudo rm -rf /usr/share/ruby-rvm /etc/rvmrc /etc/profile.d/rvm.sh
2) Run the sudo apt-get --purge remove ruby-rvm command to remove ruby.

Install RVM

@vdw
vdw / gist:5146681
Last active December 14, 2015 20:49
Basic Git commands

Basic Git commands

git init Initiate git in an existing project.

git clone git@repository_ssh Clone a project (you do not have to create a folder).

git add . Add any new files under version control.

git commit -am 'This is a message.' Commit the changes.

@vdw
vdw / gist:5205268
Last active December 15, 2015 04:59
Sublime Text 2 basic user settings

Sublime Text 2 basic user settings

Preferences.sublime-settings

{
	"auto_complete": true,
	"auto_complete_commit_on_tab": false,
	"auto_complete_delay": 50,
	"auto_complete_selector": "source - comment",
	"auto_complete_size_limit": 4194304,
@vdw
vdw / gist:5549622
Last active December 17, 2015 04:19
All about Sublime and its packages

Install Sublime Text 2 on Ubuntu

Add repository

sudo add-apt-repository ppa:webupd8team/sublime-text-2

Update

sudo apt-get update
@vdw
vdw / gist:5630003
Last active December 17, 2015 15:09
Basic CSS beautification rules

Basic CSS beautification rules

1) Order attributes alphabetically (not rules)

@vdw
vdw / gist:5640164
Created May 23, 2013 23:04
Development Enviroment

Install MySQL server in Ubuntu

1) sudo apt-get install mysql-server

2) sudo apt-get install php5-mysql for php

3) sudo apt-get install libmysql-ruby for ruby

@vdw
vdw / gist:4f90e25aff0beba8b2de
Last active August 29, 2015 14:11
Create a swap file on CentOS 6.5

Check for existing swap files

swapon -s

Create swap file with 1024k size

sudo dd if=/dev/zero of=/swapfile bs=1M count=1024

sudo mkswap /swapfile

@vdw
vdw / gist:939a61dd3fbdb04dc5b8
Last active August 29, 2015 14:13
Dotted path to Ruby nested hash

Convert a dotted path to hash

def dotted_path_to_hash(hash)
  hash.map do |pkey, pvalue|
    pkey.to_s.split(".").reverse.inject(pvalue) do |value, key|
      {key.to_sym => value}
    end
  end.inject(&:deep_merge)
end
@vdw
vdw / gist:f3c832df8ce271a036f2
Last active January 19, 2018 10:53
Ruby hash to dotted path

Convert a ruby hash to dotted path

def hash_to_dotted_path(hash, path = "")
  hash.each_with_object({}) do |(k, v), ret|
    key = path + k.to_s

    if v.is_a? Hash
      ret.merge! hash_to_dotted_path(v, key.to_s + ".")
 else