Skip to content

Instantly share code, notes, and snippets.

@delwar2016
delwar2016 / kick-start - django
Last active March 7, 2017 06:12
kick-start - django
Installtion
pip install django
Create Project
django-admin startproject home
Run server
@delwar2016
delwar2016 / magento installation issue
Last active March 17, 2017 18:08
magento installation issue
localization issue
http://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue
installation php 5.6
http://stackoverflow.com/questions/40567133/cannot-add-ppa-ppaondrej-php5-5-6
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install -y php5.6 php5.6-mcrypt php5.6-mbstring php5.6-curl php5.6-cli php5.6-mysql php5.6-gd php5.6-intl php5.6-xsl php5.6-zip libapache2-mod-php5.6
@delwar2016
delwar2016 / composer install -problem fix
Created February 15, 2017 07:28
composer install -problem fix
problem:
Problem 1
- The requested PHP extension ext-gd * is missing from your system. Install or enable PHP's gd extension.
Problem 2
- The requested PHP extension ext-curl * is missing from your system. Install or enable PHP's curl extension.
Problem 3
- Installation request for braintree/braintree_php 2.39.0 -> satisfiable by braintree/braintree_php[2.39.0].
- braintree/braintree_php 2.39.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
@delwar2016
delwar2016 / Python Regular expression
Created January 18, 2017 04:38
Python Regular expression
In Python "re" module is used to write regular expression.
What are various methods of Regular Expressions?
Most commonly used regular expressions are as follows:
1. re.match(pattern, string)
2. re.search(pattern, string)
3. re.findall(pattern, string)
4. re.split(pattern, string, [maxsplit=0])
5. re.sub(pattern, repl, string)
6. re.compile(pattern, repl, string)
@delwar2016
delwar2016 / How to stub jQuery remove using sinonJS
Created January 16, 2017 13:35
How to stub jQuery remove using sinonJS
Suppose we have following situation
$('#dom1').remove();
$('#dom2').remove();
$('#dom3').remove();
$('#dom4').remove();
So, we can write unit test as follows:
this.removeStub = sinon.stub($.fn, 'remove');
it('Should remove dom', function(){
@delwar2016
delwar2016 / Explain NumPy array object
Last active February 13, 2017 15:57
Explain NumPy array object
import numpy as np
# Manual construction of arrays
# one dimension array
a = np.array([0,1,2,3])
print(a)
print ('dimension', a.ndim)
@delwar2016
delwar2016 / Explain Python's slice notation
Last active January 10, 2017 01:59
Explain Python's slice notation
array[start:end:step] # start through not past end, by step
start: the beginning index of the slice, it will include the element at this index unless it is the same as end, defaults to 0, i.e. the first index.
If it's negative, it means to start n items from the end.
end: the ending index of the slice, it does not include the element at this index,
defaults to length of the sequence being sliced, that is, up to and including the end.
step: the amount by which the index increases, defaults to 1. If it's negative, you're slicing over the iterable in reverse.
@delwar2016
delwar2016 / Set default node version with NVM
Last active November 25, 2016 06:00
Set default node version with NVM
# To Show installed versions
nvm ls
# Set 6.1.0 (or another version) as default
nvm alias default 6.1.0
@delwar2016
delwar2016 / .Net Core Installation
Created November 18, 2016 09:52
.Net Core Installation
Link:
https://www.microsoft.com/net/core#macos
Let’s create a new virtual envirnoment, named myenv, using pyvenv:
pyvenv myenv3
source myenv3/bin/activate
and you can start Python 3 by just typing:
$ python
Note that as you are inside the virtual environment, you don’t need to use the command python3 to open Python 3.