Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
import click
import os
import pandas as pd
def file_split(file):
s = file.split('.')
name = '.'.join(s[:-1]) # get directory name
@petrovitch
petrovitch / Expressions.php
Created June 27, 2017 19:34 — forked from ircmaxell/Expressions.php
A math parser and evaluator implementation
<?php
class Parenthesis extends TerminalExpression {
protected $precidence = 6;
public function operate(Stack $stack) {
}
public function getPrecidence() {
return $this->precidence;
"aloha/twilio": "^2.0", https://github.com/aloha/laravel-twilio
"anahkiasen/underscore-php": "^2.0", https://github.com/Anahkiasen/underscore-php
"barryvdh/laravel-cors": "0.7.x", https://github.com/barryvdh/laravel-cors
"creativeorange/gravatar": "~1.0", https://github.com/creativeorange/gravatar
"genealabs/laravel-caffeine": "~0.2", https://github.com/GeneaLabs/laravel-caffeine
"guzzlehttp/guzzle": "~5.3|~6.0", https://github.com/guzzle/guzzle
"intervention/image": "^2.3", http://image.intervention.io/getting_started/installation
"kyslik/column-sortable": "~3.0.0", https://github.com/Kyslik/column-sortable
"laravel/cashier": "^5.0", https://github.com/laravel/cashier
"laravelcollective/html": "5.1.*", https://laravelcollective.com/
<?php
$query = "
select concat(n.chapter, ': ', lower(n.title)) as ata, coalesce(n.subtotal,0) as in_project, coalesce(n.total,0) as ata_total from (
select
m.chapter, m.title, m.slug,
(select count(*) as subtotal from atas a
inner join parts_listings pl on pl.ata = a.id
inner join project_parts pp on pp.part_listing_id = pl.id
where pl.ata = m.chapter and pp.in_project and a.active and pp.project_id = {$id}
@petrovitch
petrovitch / smith_waterman.php
Created December 9, 2015 21:31
Smith Waterman
<?php
/**
* smith_waterman.php
*
* The Smith–Waterman algorithm performs local sequence alignment to detect
* similarities in string. Smith-Waterman has been used for sequencing DNA,
* and for detecting plagiarism and collusion by comparing sequences of text.
*
* @example
* $str1 = 'Smith-Waterman and Systolic PE Array are well-known dynamic programming algorithms.';
@petrovitch
petrovitch / porter_stemmer.php
Created December 9, 2015 21:30
Porter Stemmer
<?php
/**
* porter_stemmer.php
*
* In linguistic morphology and information retrieval, stemming is the process
* for reducing inflected (or sometimes derived) words to their stem, base or
* root form—generally a written word form.
*
* Porter Stemmer Steps:
* - Step 1: Gets rid of plurals and -ed or -ing suffixes
@petrovitch
petrovitch / levenshtein.php
Created December 9, 2015 21:27
Levenshtein Distance
<?php
/**
* levenshtein.php
*
* CID 13a745cd-f086-4e7b-9594-79746e3d02d0
*
* Levenshtein Distance is a measure of the least number of transformations that need
* to be applied to a string to convert it into another string. We can use this to measure
* the difference between two strings. This allows us to test responses provided by users to
* determine how different they are to each other. In the results presented a high Levenshtein