- the name of a variable; false vales are: empty string("", or any string starting with "0");
- a comparison of a variable using the = and != operators;
- pattern matching with
regular expressions
:
~
performs a case-sensitive match
~*
performs a case-insensitive match i.efirefox
matchesFirefox
!~
and!~*
mean the opposite, doesn't match. - check for existence of a file using the
-f
or!-f
operators;
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
gifify() { | |
if [[ -n "$1" ]]; then | |
if [[ $2 == '--good' ]]; then | |
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png | |
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif | |
rm out-static*.png | |
else | |
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif | |
fi | |
else |
Helping Venkat in StackOverFlow link
Question Venkat.as.
Solution Updated.as
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
var v = document.querySelector('video'), | |
sources = v.querySelectorAll('source'), | |
last = sources[sources.length-1]; | |
last.addEventListener('error', function(ev){ | |
var d = document.createElement('div'); | |
d.innerHTML = v.innerHTML; | |
v.parentNode.replaceChild(d, v); | |
}, false); |
- To create project
django-admin.py startproject project_name
- To run project
python manage.py runserver 8000
andpython manage.py runserver 0.0.0.0:8000
- Update database as per model changes
python manage.py syncdb
- To create app
python manage.py startapp app_name
- Including app in site
python manage.py sql app_name
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
/** | |
* Extends Object | |
*/ | |
Object.prototype.extends = function(extension) { | |
var hasOwnProperty = Object.hasOwnProperty(), | |
object = Object.create(this); | |
for(var property in extension){ | |
if(hasOwnProperty.call(extension, property) || typeof object[property] === "undefined") | |
object[property] = extension[property]; | |
} |
A Pen by Samar Panda on CodePen.
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
// Attach event | |
function addEvent(obj, type, fn){ | |
if( obj.attachEvent ){ | |
obj['e'+type+fn] = fn; | |
obj[type+fn] = function(){obj['e'+type+fn](window.event);}; | |
obj.attachment( 'on'+type, obj[type+fn]); | |
}else | |
obj.addEventListener(type, fn, false); | |
} |