Skip to content

Instantly share code, notes, and snippets.

View ola-sk's full-sized avatar

Ola Sokolek ola-sk

View GitHub Profile
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var styleEl = document.getElementById('css-layout-hack');
if (styleEl) {
styleEl.remove();
return;
}
styleEl = document.createElement('style');
styleEl.id = 'css-layout-hack';
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var domStyle = document.createElement("style");
domStyle.append(
'* { color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }\
* * { background-color: rgba(0,255,0,.2) !important; }\
* * * { background-color: rgba(0,0,255,.2) !important; }\
* * * * { background-color: rgba(255,0,255,.2) !important; }\
* * * * * { background-color: rgba(0,255,255,.2) !important; }\
@ola-sk
ola-sk / slicing lists and NumPy arrays.py
Created December 31, 2019 21:48
5 Python Features and Cautions
# one dimensional example
import numpy as np
# list of data
data1 = [[11, 22], [33, 44], [55, 66]]
# convert datatype of data1 to numpy.ndarray
data2 = np.array(data1)
type(data2)
@ola-sk
ola-sk / counting and finding.cpp
Last active November 21, 2021 20:29
C++ STL Algorithms
#include <vector>
#include <string>
#include <algorithm>
#include <map>
int main()
{
std::vector<int> v { 2, 5, 7, 1, 0, 6, 6, 2, -2, 4, 4, 7, 9, 0, 5 }; //6 odd values
//——————————————————————————————————————————————————————————————————————————
@ola-sk
ola-sk / custom structures— structured bindings.cpp
Last active October 4, 2019 07:33
Structured bindings for unpacking bundled return values
//Practice using structured bindings on custom structures.
#include <iostream>
#include <vector>
//Define & initialize data structures
struct employee {
unsigned int id;
std::string name;
std::string role;
unsigned salary;
} e1, e2, e3;