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 / TOP NVM COMMANDS.md
Last active July 20, 2017 22:01
TOP NVM COMMANDS

Lists all versions installed;

$ nvm ls

Lists all the available Node.js versions to download and install;

$ nvm ls-remote 
@ddeveloperr
ddeveloperr / NODE.JS-INSTALATION-VIA-NVM.md
Created July 20, 2017 21:48
NODE.JS INSTALATION VIA NVM

Just like Ruby language has the RVM (Ruby Version Manager) to manage multiple Ruby versions, Node.js also has a manager too, the NVM (Node Version Manager). NVM is a perfect solution to test your projects in different Node.js versions. It is also useful for people that like to test unstable or latest versions. NVM has great advantages, it is practical, easy to use, it can uninstall a Node.js version with a single command and will save you time to search and install some Node.js version. It is a good alternative, especially on Linux which its native package managers are frequently outdated and invalidates a new Node.js version to be installed.

SETUP NVM

In few steps you can set up NVM into a MacOSX or Linux system, you just need to run this command:

curl https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash
@ddeveloperr
ddeveloperr / remove-with-git.md
Created July 14, 2017 16:19
Removing/update multiple files from a Git repo that have already been deleted from disk

Git Cheat Sheet

Basic commands

git init Creates a new git repository in the directory

git add <file name> Adds a specific file to staging

git add . or git add -A Adds the full directory and its contents to staging

[
{
"city": "New York",
"growth_from_2000_to_2013": "4.8%",
"latitude": 40.7127837,
"longitude": -74.0059413,
"population": "8405837",
"rank": "1",
"state": "New York"
},
class Scrape
attr_accessor :title, :hotness, :image_url, :rating, :director,
:genre, :runtime, :synopsis, :failure
def scrape_new_movie
begin
doc = Nokogiri::HTML(open("https://www.rottentomatoes.com/m/the_martian/"))
doc.css('script').remove
self.title = doc.at("//h1").text.strip
self.hotness = doc.at_css('span.meter-value').text[0, doc.at_css('span.meter-value').text.index('%')]
Rails on Rails Cheat Sheet -- Includes updates from Rails 5.0
1. Open terminal and check versions of Ruby and Rails against production server params or to make sure you are using the most recent stable versions.
$ ruby -v
$ rvm list
$ rvm list known
$ rvm install ruby 2.3.1
$ rvm list
$ ruby -v
$ gem install rails
@ddeveloperr
ddeveloperr / css-selectors.md
Created October 10, 2016 19:46
CSS must-know selectors

###1. *

* { margin: 0; padding: 0; }

Let’s knock the obvious ones out, for the beginners, before we move onto the more advanced selectors. The star symbol will target every single element on the page. Many developers will use this trick to zero out the margins and padding. While this is certainly fine for quick tests, I’d advise you to never use this in production code. It adds too much weight on the browser, and is unnecessary.

@ddeveloperr
ddeveloperr / git_push_force_upstream.md
Last active September 6, 2023 15:52
How to force “git push” to overwrite remote repo files WITH LOCAL files

You want to push your local files to remote files

git push -f <remote> <branch>
git push -f origin master

Local version has priority over the remote one!

more...

@ddeveloperr
ddeveloperr / latency.markdown
Created April 6, 2016 12:09 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs