Skip to content

Instantly share code, notes, and snippets.

Barry Steyn barrysteyn

Block or report user

Report or block barrysteyn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@barrysteyn
barrysteyn / .eslintrc.js
Created Dec 29, 2015 — forked from nkbt/.eslintrc.js
Strict ESLint config for React, ES6 (based on Airbnb Code style)
View .eslintrc.js
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@barrysteyn
barrysteyn / README.md
Last active Dec 12, 2018
C/C++ Examples For Understanding
View README.md

Introduction

These toy examples are for helping with understanding C/C++. There is an excellent C++ samples site which demonstrates many useful things.

@barrysteyn
barrysteyn / svn-to-git.md
Last active Apr 30, 2019
Migrate From SVN To GIT
View svn-to-git.md
@barrysteyn
barrysteyn / README.md
Last active Dec 29, 2015
Useful Posix Commands
View README.md

Useful Posix Commands

These commands are as Posix possible. Where differences exist between operating systems, specific instructions for the OS will be noted.

@barrysteyn
barrysteyn / Base64.md
Last active May 6, 2019
OpenSSL Base64 En/Decode: Portable and binary safe.
View Base64.md

OpenSSL Base64 Encoding: Binary Safe and Portable

Herewith is an example of encoding to and from base64 using OpenSSL's C library. Code presented here is both binary safe, and portable (i.e. it should work on any Posix compliant system e.g. FreeBSD and Linux).

License

The MIT License (MIT)

Copyright (c) 2013 Barry Steyn

View .README.md

VIM

Setup

Copy the .vimrc file below

Useful Commands

@barrysteyn
barrysteyn / substring.cpp
Last active Dec 20, 2015
LeetCode: Substring with concatenation of all words (http://leetcode.com/onlinejudge#question_30)
View substring.cpp
/*
* This is a very cool method to perform the leetcode task.
* It is time O(n) (n being the size of string S) if it is
* implemented with an unordered_map on line 65, otherwise it
* is O(n*log(m)) (m being the size of the vector L)
*
* This method demonstrates how hashes can be used for
* comparison instead of strings. It is inspired by
* the topcoder article: http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=stringSearching
*/
View edit_distance_1.cpp
/*
* Dynamic programming at its best! The trick is
* that erasing a character, and inserting a character
* are inverse operations and therefore can be considered
* just one operation (See comments below)
*/
class Solution {
public:
View rotate_matrix.cpp
class Solution {
public:
void rotate(vector<vector<int> > &matrix) {
int N = matrix.size()-1,
temp = 0;
for (int i=0; i < N; i++) {
for (int j=0; j+i < N; j++) {
//Only one temp variable is needed
View bubble_sort.cpp
/*
* My Canonical example of a C bubble sort
* This is still O(n^2) (no getting away from that)
* but it is slightly more efficient than the classic
* examples given in textbooks because the inner loop
* loops one less every time
*/
void bubbleSort_c(int *arr, int size) {
int temp = 0;
You can’t perform that action at this time.