Skip to content

Instantly share code, notes, and snippets.

Avatar

michaelxuan loveplay1983

View GitHub Profile
View codingstandards-0-automatedanalysis.md

C++ Coding Standards Part 0: Automated Code Analysis

Automated analysis is the main advantage to working with a modern statically typed compiled language like C++. Code analysis tools can inform us when we have implemented an operator overload with a non-canonical form, when we should have made a method const, or when the scope of a variable can be reduced.

In short, these tools catch the most commonly agreed best practice mistakes we are making and help educate us to write better code. We will be fully utilizing these tools.

Compilers

All reasonable warning levels should be enabled. Some warning levels, such as GCC's -Weffc++ warning mode can be too noisy and will not be recommended for normal compilation.

@loveplay1983
loveplay1983 / tips_and_tricks.md
Created Aug 15, 2018 — forked from omaciel/tips_and_tricks.md
A collection of Python tips and tricks
View tips_and_tricks.md

Flatten a dictionary

  In [1]: k = {'name': 'Og Maciel', 'age': 40, 'mansions': '', 'kids': 3}
  In [2]: ' '.join("--{!s}={!r}".format(key,val) for (key,val) in k.iteritems())
  "--age=40 --kids=3 --name='Og Maciel' --mansions=''"

Run Unittest TestCase from IPython

View aspnet-mvc.gitignore
###################
# compiled source #
###################
*.com
*.class
*.dll
*.exe
*.pdb
*.dll.config
*.cache
@loveplay1983
loveplay1983 / regex.md
Created Apr 11, 2018 — forked from vitorbritto/regex.md
Regex Cheat Sheet
View regex.md

Regular Expressions

Basic Syntax

  • /.../: Start and end regex delimiters
  • |: Alternation
  • (): Grouping
View compare-svm-kernels.py
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from sklearn.cross_validation import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.datasets import make_moons, make_circles, make_classification
from sklearn.svm import SVC
h = .02 # step size in the mesh
View python_blackjack.py
import os
import random
deck = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]*4
def deal(deck):
hand = []
for i in range(2):
random.shuffle(deck)
card = deck.pop()