Skip to content

Instantly share code, notes, and snippets.

View umarsohail1998's full-sized avatar
🎯
Focusing

M. Umar Sohail umarsohail1998

🎯
Focusing
View GitHub Profile
@mneedham
mneedham / blog_domain.py
Last active January 29, 2022 14:40
Altair - Setting a custom date domain for the x axis
# Code for https://markhneedham.com/blog/2020/01/14/altair-range-values-dates-axis/ blog post
import altair as alt
import pandas as pd
import datetime
df = pd.DataFrame( [
{"position": 40, "date": datetime.date(2019,9,5)},
{"position": 31, "date": datetime.date(2019,9,12)},
{"position": 19, "date": datetime.date(2019,9,19)},
@lienista
lienista / practice-precendence-rule.js
Created October 23, 2018 02:11
(Algorithms in Javascript) Practice. A precedence rule is given as "P>E", which means that letter "P" is followed by letter "E". Write a function, given an array of precedence rules, that finds the word represented by the given rules. Note: Each represented word contains a set of unique characters, i.e. the word does not contain duplicate letters.
/*
we create 2 separate arrays of letters and count
the number of characters resulting from the
original precedence array.
we look up the index of each letter from first letter
array and follow the index of the next letter.
*/
function findWord(a){
console.log(a);
@WPettersson
WPettersson / example.py
Created July 12, 2016 00:09
Example CPLEX python script
#/usr/bin/env python3
import cplex
# Create an instance of a linear problem to solve
problem = cplex.Cplex()
# We want to find a maximum of our objective function
problem.objective.set_sense(problem.objective.sense.maximize)
@unixpickle
unixpickle / argcount.pl
Created November 5, 2010 02:33
count the number of command-line arguments in perl
#!/usr/bin/perl
use strict;
sub arrcount {
my ($arr) = @_;
my $c = 0;
foreach my $str (@{$arr}) {
++$c;
}