Skip to content

Instantly share code, notes, and snippets.

View markconde's full-sized avatar

Mark Conde markconde

  • Singapore
View GitHub Profile
@markconde
markconde / version_compare.js
Created May 31, 2022 15:36 — forked from pc035860/version_compare.js
Function to compare two version strings (e.g. "1.6.1" is smaller than "1.7"). Developed in order to answer http://stackoverflow.com/a/6832721/50079.
/**
* Compares two software version numbers (e.g. "1.7.1" or "1.2b").
*
* This function was born in http://stackoverflow.com/a/6832721.
*
* @param {string} v1 The first version to be compared.
* @param {string} v2 The second version to be compared.
* @param {object} [options] Optional flags that affect comparison behavior:
* <ul>
* <li>
@markconde
markconde / index.php
Created April 3, 2018 03:23
Counting visits by session - run using ```php -S localhost:3000```
<?php session_start();
$session_ctr = array_key_exists('session_ctr', $_SESSION) ? $_SESSION['session_ctr'] : 0 ;
$session_ctr = $session_ctr + 1;
$_SESSION['session_ctr'] = $session_ctr;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Counting Visits By Section</title>
#office apps
brew cask install microsoft-office
brew cask install libreoffice
#productivity and utilities
brew cask install alfred
brew cask install 1password
brew cask install iterm2
brew cask install nvalt
from bs4 import BeautifulSoup
import bs4
import re
soup = BeautifulSoup(open("./test.html"),'html5lib');
acf_tags = ['rw-test','rw-repeater']
def is_acf_keyword(classname):
@markconde
markconde / gist:3da69d959a4a0e8968b645aa69f36046
Last active July 24, 2017 04:12
Common terminal commands
#download files via wget through ftp
wget -X {EXCLUDED_FOLDERS,} -l {MAX_DEPTH} -r ftp://{USERNAME}:{PASSWORD}@{HOST}/{PATH}
#secure copy
scp {username}@{host}:{path} {destination}
#dump mysql table remotely
mysqldump -h{HOST} -u{USERNAME} -p{password} > {filename}.sql
#zip files