Table of Contents generated with DocToc
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
// Your code here! | |
extern crate rustc_version; | |
fn main(){println!("XXXXXXXX"); | |
otherFun(); | |
} | |
fn otherFun(){ | |
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 isLeap(x) { | |
let leap = (x % 4 == 0 && x % 100 != 0) || x % 400 == 0; | |
console.log(leap ? "yes" : "no"); | |
} | |
isLeap(['2016']); |
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
DECLARE @s VARCHAR(50)= 'City-Of-Style' | |
SELECT SUBSTRING(@s,0,CHARINDEX('-',@s,0)) AS firstPart, | |
SUBSTRING(@s,CHARINDEX('-',@s,0)+1,LEN(@s)) AS secondPart |
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
>>> a = [1, 2, 3, 4, 5] | |
>>> b = [9, 8, 7, 6, 5] | |
>>> set(a) & set(b) | |
{5} |
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 dub(li, li1: list): | |
#find dublicates in two list, easy but not effective solution | |
print(set(li) & set(li1)) | |
dub(["a","b","c","c","d","d","c","f","l"],["a","b","a"]) |
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
/** | |
* Created by user on 18/05/17. | |
*/ | |
// Super useful for debug in web console | |
function print_filter(filter){ | |
var f=eval(filter); | |
if (typeof(f.length) != "undefined") {}else{} | |
if (typeof(f.top) != "undefined") {f=f.top(Infinity);}else{} | |
if (typeof(f.dimension) != "undefined") {f=f.dimension(function(d) { return "";}).top(Infinity);}else{} | |
console.log("DC DEBUG: "+filter+"("+f.length+") = "+JSON.stringify(f).replace("[","[\n\t").replace(/}\,/g,"},\n\t").replace("]","\n]")); |
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
import numpy as np | |
import pandas as pd | |
import seaborn as sns | |
import matplotlib.pyplot as plt | |
sns.set(style="ticks") | |
# Create a dataset with many short random walks | |
rs = np.random.RandomState(4) | |
pos = rs.randint(-1, 2, (20, 5)).cumsum(axis=1) | |
pos -= pos[:, 0, np.newaxis] |
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
""" | |
Example demonstrating a Bokeh plot in Flexx, using a Phosphor dock panel | |
layout. Includes client-side interaction with sliders. | |
""" | |
import numpy as np | |
from bokeh.plotting import figure | |
from flexx import app, ui, react |
NewerOlder