- Create a react app with typescript template
npx create-react-app . --template typescript
- Create .editorconfig on the root folder:
#!/bin/bash | |
PROGRAMS=(phpmd php-cs-fixer phpcpd phploc) | |
for PROGRAM in ${PROGRAMS[*]}; | |
do | |
command -v $PROGRAM >/dev/null 2>&1 || { echo "I require $PROGRAM but it's not installed. Aborting." >&2; exit 1; } | |
done | |
echo "=======================================================================================" | |
echo "Fixing code standard" |
To run php on sublime: | |
* Select Tools->Build System->New Build System | |
* Copy the following code to the created file: | |
{ | |
"cmd" : ["php", "$file"], | |
"file_regex" : "php$", | |
"selector" : "source.php" | |
} |
1) Look up on the internet the simple code for generating the base html5 structure; | |
2) What would be the code for generating the following structure: | |
<div> | |
<ul> | |
<li></li> | |
<li></li> | |
<li></li> | |
</ul> | |
</div> |
var cheerio = require('cheerio'); | |
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; | |
function httpGet(theUrl) { | |
var xmlHttp = new XMLHttpRequest(); | |
xmlHttp.open("GET", theUrl, false); // false for synchronous request | |
xmlHttp.send(null); | |
return xmlHttp.responseText; | |
} |
# Solves the "Miojo with 2 hourglasses" problem | |
# cooking time and both hourglass times are passed as arguments, as in the following sample: | |
# ruby miojoproblem.rb 3 5 7 | |
# returns the minimum total time to cook the miojo accurately, or a fail message if not possible | |
# Solution is ad-hoc, can probably be optimized a lot | |
raise "Must specify 3 inputs: Miojo cooking time, hourglass 1 time, hourglass 2 time." if ARGV.length != 3 | |
cook_time = ARGV[0].to_i | |
hg_1 = ARGV[1].to_i |
# Calculates geometric distances between all given points | |
# coordinates are passed as arguments, as in the following sample: | |
# ruby geodistance.rb 62.425,52.424 42.0,90.5256 0.0,0.0 90.0,-180.0 | |
# returns the distance in kilometers | |
## | |
# Haversine Distance Calculation Function | |
# | |
# by https://gist.github.com/timols/5268103 | |
# Accepts two coordinates in the form |
# Silly code to generate all combinations of species, background and gods that spell english words (according to NLTK) | |
# for Dungeon Crawl Stone Soup (as of 0.23) | |
from nltk.corpus import words | |
species = [ | |
"Ba", | |
"Ce", | |
"DD", | |
"DE", |
import os | |
def split(filehandler, delimiter=',', row_limit=10000, | |
output_name_template='output_%s.csv', output_path='.', keep_headers=True): | |
""" | |
Splits a CSV file into multiple pieces. | |
A quick bastardization of the Python CSV library. | |
Arguments: | |
`row_limit`: The number of rows you want in each output file. 10,000 by default. |
import sqlite3 | |
import csv | |
import pandas as pd | |
def main(): | |
database_file = "CNPJ_full.db" | |
conn = conn = sqlite3.connect(database_file) | |
df = pd.read_sql_query("SELECT * FROM empresas WHERE municipio='PELOTAS'", conn) |