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
<html> | |
<head> | |
<title>SAMPLE2</title> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<!--[if lte IE 8]><script src="assets/css/ie/html5shiv.js"></script><![endif]--> | |
<link rel="stylesheet" href="assets/css/main.css" /> | |
<link rel="stylesheet" href="assets/css/style.css" /> | |
<!--[if lte IE 9]><link rel="stylesheet" href="assets/css/ie/v9.css" /><![endif]--> | |
<!--[if lte IE 8]><link rel="stylesheet" href="assets/css/ie/v8.css" /><![endif]--> |
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
<body class="landing"> | |
<div id="topdiv" class="button special"> <a href="#page-wrapper" class="goto-next scrolly"></a></div> | |
<div id="page-wrapper"> | |
<!-- Header --> | |
<p id="#demo1"></p> | |
<button onclick="myFunction();">Change</button> | |
<br> | |
<img id="dateimage1" class='change-img' src="http://vignette4.wikia.nocookie.net/pacman/images/2/2d/Pinkyyghost.png/revision/latest?cb=20090919170357" alt="Loading..." width="75%" /> |
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
def splitStringList(X): | |
newX = [] | |
for x in X: | |
newx = [] | |
for i in re.split('[^a-z]+',x): | |
if i: | |
newx.append(i) | |
newX.append(newx) | |
return newX |
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
from bs4 import BeautifulSoup | |
import requests | |
url = 'https://en.wikipedia.org/wiki/Transhumanism' | |
# get contents from url | |
content = requests.get(url).content | |
# get soup | |
soup = BeautifulSoup(content,'lxml') # choose lxml parser | |
# find the tag : <div class="toc"> | |
tag = soup.find('div', {'class' : 'toc'}) # id="toc" also works |
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
from bs4 import BeautifulSoup | |
import requests | |
url = 'https://en.wikipedia.org/wiki/Transhumanism' | |
# get contents from url | |
content = requests.get(url).content | |
# get soup | |
soup = BeautifulSoup(content,'lxml') # choose lxml parser | |
# find all the references | |
ref_tags = soup.findAll('span', { 'class' : 'reference-text' }) |
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
from bs4 import BeautifulSoup | |
import requests | |
url = 'https://en.wikipedia.org/wiki/Transhumanism' | |
# get contents from url | |
content = requests.get(url).content | |
# get soup | |
soup = BeautifulSoup(content,'lxml') # choose lxml parser | |
# find all the paragraph tags | |
p_tags = soup.findAll('p') |
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
lst = [ 'file', 'if', 'hat', 'zoltan', 'calculator', 'cup', 'pocket', 'symbolic', 'I', 'attributes' ] | |
sorted_lst1 = sorted(lst, key=len) | |
print(sorted_lst1) | |
## OUTPUT : ['I', 'if', 'hat', 'cup', 'file', 'zoltan', 'pocket', 'symbolic', 'calculator', 'attributes'] | |
sorted_lst2 = sorted(lst, key=lambda item : (len(item),item[0]) ) | |
print(sorted_lst2) | |
## OUTPUT : ['I', 'if', 'cup', 'hat', 'file', 'pocket', 'zoltan', 'symbolic', 'attributes', 'calculator'] | |
# alternative to lambda | |
def len_alpha(item): | |
return ( len(item), item[0] ) |
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
casper = require('casper').create({ | |
verbose : true, | |
logLevel : 'debug', // debug, info, warning, error, | |
pageSettings: { | |
logImages : false, | |
logPlugins : false, | |
//userAgent : 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)' | |
//userAgent : 'Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19' | |
userAgent : 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.149 Safari/537.36' |
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
def renamehip(): | |
com.rename('hip') | |
def renameknee(): | |
com.rename('knee') | |
def renameankle(): | |
com.rename('ankle') | |
def renamefoot(): | |
com.rename('foot') | |
def renamefootend(): | |
com.rename('footend') |
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
function Grid(cells, generation, cell_scale){ | |
this.text = " all work and no play makes jack a dull boy "; | |
// cells | |
this.cells = cells; | |
this.generation = generation; | |
// scale | |
this.cell_scale = cell_scale; | |
// create next generation | |
this.next_gen = function(ruleset){ |
OlderNewer