Skip to content

Instantly share code, notes, and snippets.

View co89757's full-sized avatar

gueuz co89757

  • United States
View GitHub Profile
@co89757
co89757 / Coder Notes.md
Last active April 3, 2016 05:56
a scrap note for programming learning

C++ Notes

C++ 11 features

* bind function
Mixing bound and call arguments with placeholders
  • Example
#include <functional>
using namespace std;
using namespace std::placeholders; // needed for _1, _2, etc
int sum3(int a, int b, int c)
@co89757
co89757 / 0_reuse_code.js
Created August 24, 2014 21:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@co89757
co89757 / javanotes.md
Last active August 29, 2015 14:05
java notes

#JAVA Notes

Chap. Access Control and Code Organization

  • Library Unit: package
  • Compilation Unit: .java src files
    • each src file should have only ONE public class and all else are supporting classes with package access
  • a package statement: package [package_name];
@co89757
co89757 / comm01_colin.md
Last active August 29, 2015 14:05
COMP404 COMM.01 Draft

Comparative study of programming paradigms

Overview

Procedural programming is the most primitive programming paradigm. It treats compuation as a set of sequential steps. It packages a set of repeatable steps in functions that takes input arguments. The most popular language for procedural programming is C. It iterative and sequential and has little overhead therefore high execution speed and small size. It is often used to optimize the performance of a certain portion of code. But it doesn't scale well with large systems and becomes hard to maintain as the software grows.

Object-oriented programming (OOP) stands for a programming paradigm that are marked by 'objects' that encapsulate data fields and behaviors ('methods'). It also imposes access control on class members to keep users from tampering with internals of a class. Hence it has better safety and decomposition.OOP works by interaction between objects. It also enables inheritance and polymorphism. Inheritance means that a class can derive from

@co89757
co89757 / PythonGists.md
Last active November 27, 2018 04:22
code snippets and cookbook for py

String/ Text

Filter a string for a set of chars

import string
# Make a reusable string of all characters, which does double duty
# as a translation table specifying "no translation whatsoever"
allchars = string.maketrans('', '')
def makefilter(keep):
""" Return a function that takes a string and returns a partial copy
@co89757
co89757 / linuxGist.md
Last active August 29, 2015 14:06
linux bash notes

#Basics

writing output with no \n at the end echo -n 'something with no newline'

redirecting stdout and stderr to the same file

both >& outfile

A hyphen indicates that input is taken from the keyboard. In this example, to create a new file file2 that consists of text typed in from the keyboard followed by the contents of file1

@co89757
co89757 / HaskellGist.md
Last active August 29, 2015 14:06
Gist for Haskell

#Start-out Booleans: &&, ||, not , ==, /=(not equal)

Basic functions(prefix or use `` for infix):

succ 8 returns 9

Function syntax

functions can't begin with uppercase letters.

@co89757
co89757 / leetGist.md
Last active August 29, 2015 14:07
coding interview drill with commentary

Fundamentals

Gray Code

Binary2Gray conversion

unsigned int binary2gray(unsigned int bi){
return bi ^ (bi>>1) ;
}
@co89757
co89757 / epsgTableScrape.py
Last active September 25, 2015 16:10
scrape from EPSG lookup website various proj defn
```python
#!/usr/bin/python
import requests as rq
import bs4
import logging
logging.basicConfig(filename="epsgCrawl.log",level=logging.WARNING, format="%(levelname)s::%(message)s")
class EPSGLookup(object):
"""docstring for EPSGLookup"""
@co89757
co89757 / gitnotes.md
Last active November 20, 2017 21:24
Git Basics

Setting up and starting

  • Create a new local repo: git init
  • Clone a repo from github git clone [URL]

##Basic Snapshotting

check status: git status -s (-s is for short)

use git diff

  1. git diff shows the patch (unstaged changes since last commit)