This file contains hidden or 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
import threading | |
import time | |
def calc_square(numbers): | |
print("calculate square numbers") | |
for n in numbers: | |
time.sleep(0.2) | |
print('square', n*n) | |
def calc_cube(numbers): |
This file contains hidden or 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
from flask import Flask, request, make_response, redirect, \ | |
render_template | |
app = Flask(__name__) | |
@app.route('/') | |
def index(): | |
return render_template('index.html') | |
@app.route('/user/<name>') | |
def user(name): |
This file contains hidden or 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
from flask import Flask, request, make_response, redirect | |
app = Flask(__name__) | |
@app.route('/') | |
def index(): | |
return redirect('http://www.sntsh.com/') | |
if __name__ == '__main__': | |
app.run(debug=True) |
This file contains hidden or 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
from flask import Flask, request | |
app = Flask(__name__) | |
@app.route('/') | |
def index(): | |
user_agent = request.headers.get('User-Agent') | |
return '<p>Your browser is {}!</p>'.format(user_agent) | |
@app.route('/user/<name>') | |
def user(name): |
This file contains hidden or 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
function digitSum(n) { | |
n = parseInt(n).toString() | |
var sum = 0; | |
for (var i = 0; i < n.length; i++) { | |
sum += parseInt(n[i]); | |
} | |
return sum; | |
} |
This file contains hidden or 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
function arrayMinimum(inputArray) { | |
var indexOfMinimum = 0; | |
for (var i = 1; i < inputArray.length; i++) { | |
if (inputArray[i] < inputArray[indexOfMinimum]) { | |
indexOfMinimum = i; | |
} | |
} | |
return inputArray[indexOfMinimum] ; | |
} |
This file contains hidden or 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 IMAGE TO FEED | |
===================*/ | |
// display featured post thumbnails in RSS feeds | |
function WPGood_rss_thumbs( $content ) { | |
global $post; | |
if( has_post_thumbnail( $post->ID ) ) { | |
$content = '<figure>' . get_the_post_thumbnail( $post->ID, 'large' ) . '</figure>' . $content; | |
} |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title> Practicing </title> | |
<link href="https://fonts.googleapis.com/css?family=Josefin+Sans" rel="stylesheet"> | |
</head> | |
<style type="text/css"> | |
.thumbnail-grid { | |
user-select: none |
This file contains hidden or 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
" {{ | |
se nocompatible autoindent autoread autowrite autowriteall confirm cindent expandtab foldenable gdefault hidden hlsearch ignorecase incsearch lazyredraw lbr nu ruler sm sc smd scs smartindent sta spell splitright ttyfast undofile noerrorbells wildmenu wrap equalalways splitbelow wrapscan list | |
" }} | |
se dir=~/tmp/vimswapfiles//,~/.vim/vimswapfiles// bs=eol,start,indent,start cb=unnamed cc=-1 cot=menu,longest,preview enc=utf-8 ffs=unix fdm=marker foldlevel=0 fmr={{,}} foldopen=block,hor,insert,jump,mark,percent,quickfix,search,tag,undo formatoptions=tcqrn1 history=100 laststatus=2 matchtime=1 mouse=a nrformats=octal,hex,alpha scrolloff=5 shiftwidth=4 softtabstop=4 spl=en_us timeoutlen=300 tw=77 ts=4 undolevels=1000 udir=~/tmp/vimundo,~/.vim/vimundo uc=10 whichwrap+=<,>,[,],h,l wildchar=<tab> wig=*.o,*.obj,*.bak,*.exe,*.py[co],*.swp,*~,*.pyc,.svn guioptions-=T lcs=tab:?\ ,eol:¬,trail:·,nbsp:? | |
" ESSENTIALS | |
" ========== | |
" {{ | |
filetype plugin indent on | |
let snips_author = 'Santosh Kumar' |