This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# When you have __init__.py (blank one), you can import the module using | |
from dirname import MyModule | |
# But when you dont have _init_.py at all, you cannot import the module without adding the path till that module to PYTHONPATH. | |
# In this case from dirname import MyModule FAILS, or reports error. | |
# If a directory (folder) contains a __init__.py file then it becomes a package. | |
# What you thought you read was not strictly correct, as you found. | |
# A package can be imported as if it was a module by itself, and any code in __init__.py is run, although it is often empty. | |
# Packages are a way of grouping multiple modules together, and you can load them using: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ apt-get remove python-pip | |
$ easy_install pip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SEARCH TABLE NAME: | |
SHOW TABLES FROM master LIKE '%table_name%'; | |
# CHECK MYSQL CONF: | |
cat /etc/my.cnf | |
# BACKUP SINGLE DATABASE: | |
mysqldump -u username -p database_to_backup > backup_name.sql | |
# RESTORE SINGLE DATABASE: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# AVOID SUDO PASSWORD: | |
# sudo: no tty present and no askpass program specified | |
$ sudo visudo | |
$ my_slave_user ALL=(ALL) NOPASSWD: ALL | |
# FORMATING A PENDRIVE: | |
# To show all the volume in your pc | |
sudo fdisk -l | |
# To see the usb flash drive suppose it may be /deb/sdb1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add gradle to existing java project: | |
//Step 1: | |
build.gradle | |
//Step 2: | |
apply plugin: 'idea' | |
apply plugin: 'java' | |
//Step 3: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(".txtClass") => getElementsByClassName() | |
$("#childDiv2 .txtClass") => getElementById(), then getElementsByClassName() | |
$("#childDiv2 > .txtClass") => getElementById(), then iterate over children and check class | |
$("input.txtClass") => getElementsByTagName(), then iterate over results and check class | |
$("#childDiv2 input.txtClass") => getElementById(), then getElementsByTagName(), then iterate over results and check class | |
//Example: | |
$('.txtClass'); | |
$('#childDiv2 .txtClass') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
$ sudo npm install -g coffee-script | |
### | |
# COMPARING TERNARY CODE: | |
@getInstance: -> | |
Instante ?= new DeviceManager() | |
DeviceManagerSingleton.getInstance = function() { | |
return Instante != null ? Instante : Instante = new DeviceManager(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//****************************************************************** | |
// Steps to set nodejs, expressjs and grunt: | |
// 1. Install nodejs | |
// $ sudo npm install nodejs | |
// 2. Install expressjs//# 3. Install grunt-cli | |
// 5. Create a project using express (building a skeleton directory) | |
// 6. Install grunt | |
// 7. Create Package folder | |
// 8. Run grunt command | |
// 9. Create basic create and clean tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Count an array that is embedded into document. | |
// Document: | |
{name: 'Pepito', tags: ['A', 'B', 'C', 'D']} | |
//Mongodb query: | |
db.employees.aggregate( | |
{$match: {name : "Pepito"}}, | |
{$unwind: "$tags"}, | |
{$group: {_id: null, number: {$sum: 1 }}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CHECKOUT BRANCH | |
$ checkout branch -f | |
$ git pull | |
# CHECK CHANED FILES IN GIT COMMIT: | |
$ git log | |
$ git log -p -2 | |
$ git log --pretty=oneline | |
$ git log --name-only | |
$ git log -1 --stat |