Skip to content

Instantly share code, notes, and snippets.

@oilsinwater
oilsinwater / csv_dict_df.py
Created October 29, 2017 07:22
csv to Python dict to Pandas DataFrame
import csv
from pandas import DataFrame as df
# -- View --
def transform_data(file_name):
"""Function transform CSV file data into Python Dictionary Object"""
with open(file_name, 'r') as file_handle:
key_list = []
value_list = []
@oilsinwater
oilsinwater / main.js
Created December 18, 2017 21:31
philCoin
// import of library for hash functions
const SHA256 = require('crypto-js/sha256');
// class to determine what the blockchain will look like
class Block {/* */
// data would store terms of currency would store sender and receiver information
// previoushash ensure integrity of data
constructor(index, timestamp, data, previoushash = '') {
this.index = index;
this.timestamp = timestamp;
@oilsinwater
oilsinwater / Git Usage
Last active February 5, 2018 03:09
Git Immersion Notes
## Setup name and email
git config --global user.name "..."
git config --global user.email "..."
## Setup line ending preferences, for mac
git config --global core.autocrlf input
git config --global core.safecrlf true
## Set default text editor
@oilsinwater
oilsinwater / cat to clipboard
Created February 5, 2018 03:11
CLI copy to clipboard
cat ~/.../Somefile.text | pbcopy
@oilsinwater
oilsinwater / Some .gitignore template
Created February 5, 2018 03:34
.gitignore template
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
# Ignore the default SQLite database.
@oilsinwater
oilsinwater / python game
Created February 5, 2018 03:56
Magic8ball.py
import random
def getAnswer (answerNumber):
if answerNumber == 1:
return 'It is certain'
elif answerNumber == 2:
return 'It is decidely so'
elif answerNumber == 3:
return 'Yes'
elif answerNumber == 4:
return 'Reply hazy try again'
@oilsinwater
oilsinwater / fetchAPI.md
Last active February 19, 2018 23:39
Introduction to Fetch API

[TOC]

Fetch API

@(js study notes)[js, dev, web]

What is window.fetch

Modern replacement for XMLHttpRequest

  • Handles redirection, decodes common formant
  • Promise based(cleaner code)
@oilsinwater
oilsinwater / serviceWorkerCaches.md
Last active February 13, 2018 09:49
Caching files with the Service Worker

[TOC]

Caching files Service Workers

What is Cache API?

While this API was intended for service workers, it is actually exposed on the window so it can be accessed from anywhere in your script. The entry point is caches.

  • ** Used to store assets that have a URL
    • Formally: "a request to response map" (spec)