Skip to content

Instantly share code, notes, and snippets.

View ddeveloperr's full-sized avatar
👨‍💻
Doist

Kemal C. ddeveloperr

👨‍💻
Doist
View GitHub Profile
@ddeveloperr
ddeveloperr / remove_deleted_file_git.md
Last active April 4, 2016 18:07
Remove multiple deleted files in Git repo

Problem: Remove multiple deleted files in Git repo

Note that '~$' stands for root directory in your terminal

Solutions:

This command will ONLY remove the deleted files from the git:

@ddeveloperr
ddeveloperr / us_states.rb
Created April 1, 2016 18:17
US states array
states = Array[ ["AK", "Alaska"],
["AL", "Alabama"],
["AR", "Arkansas"],
["AS", "American Samoa"],
["AZ", "Arizona"],
["CA", "California"],
["CO", "Colorado"],
["CT", "Connecticut"],
["DC", "District of Columbia"],
["DE", "Delaware"],

How to Check ubuntu version using terminal

$ lsb_release -a

####And you will got something like a :

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.3 LTS
@ddeveloperr
ddeveloperr / basic_unix.md
Created February 23, 2016 10:29
Basic UNIX and Git Commands

UNIX Commands

pwd present working directory

ls list current directory contents

ls -la list current directory contents in long format and show hidden files

man <some unix command> Bring up the manual pages for a command. Type q to exit

@ddeveloperr
ddeveloperr / params_hash.txt
Created February 22, 2016 14:16
Deep learning The Params Hash in Ruby on Rails
Deep learning here: https://www.youtube.com/watch?v=y57OnWV6dRE
https://gorails.com/episodes/the-params-hash?autoplay=1
@ddeveloperr
ddeveloperr / ror_migrate.txt
Last active February 22, 2016 07:50
Migrations in Ruby on Rails
Migration Overview
Migrations are a convenient way to alter your database schema over time in a consistent and easy way.
They use a Ruby DSL so that you don't have to write SQL by hand, allowing your schema and changes to be
database independent.
db:migrate runs (single) migrations that have not run yet.
db:create creates the database
db:drop deletes the database
db:schema:load creates tables and columns within the (existing) database following schema.rb
@ddeveloperr
ddeveloperr / hover_over_link.txt
Last active February 11, 2016 16:19
Ho to Preview Image When I Hover Over Link?
@ddeveloperr
ddeveloperr / cURL.txt
Created February 7, 2016 17:18
Using cURL to automate HTTP jobs
TO LEARN: https://curl.haxx.se/docs/httpscripting.html
Why cURL?
Because: http://code.tutsplus.com/tutorials/techniques-for-mastering-curl--net-8470
@ddeveloperr
ddeveloperr / recursive_examples.rb
Created February 6, 2016 00:46
A recursive functions/methods in Ruby?
## More details: http://ruby.bastardsbook.com/chapters/recursion/
#1
def countdown(n)
return if n.zero? # base case
puts n
countdown(n-1) # getting closer to base case
end
countdown(5) # > 5 4 3 2 1
@ddeveloperr
ddeveloperr / Binary_Tree.rb
Created February 6, 2016 00:22
Algorithm and Data Structures With Ruby - #8 Binary Tree
# Example of Self-Referential Data Structures - A Binary Tree
class TreeNode
attr_accessor :value, :left, :right
# The Tree node contains a value, and a pointer to two children - left and right
# Values lesser than this node will be inserted on its left
# Values greater than it will be inserted on its right
def initialize val,left,right
@value = val