Skip to content

Instantly share code, notes, and snippets.

View 0xch4z's full-sized avatar
🪣

Charlie Kenney 0xch4z

🪣
View GitHub Profile
#!/usr/bin/env bash
FORCE=''
while getopts ":f:" opt; do
case $opt in
f)
echo "forcefully cleaning docker containers and images..." >&2
FORCE='--force'
;;

Vuex Notes

What is Vuex?

Vuex is a centralized state management pattern and library for Vue applications (similar to redux, only instead it mutates the state directly instead of returning a brand new one; reducers vs. mutations). This centralized state is the single source of truth for the application and provides data that is accessible by any view in the application (better alternative than passing down data to child components).

Concepts

  • State Tree: An object containing data
  • Getters: Functions that return data from the State Tree
  • Mutations: Functions that perform modifications on the data in the State Tree
  • Actions: Functions that commit Mutations. Main difference from Mutations is that Actions can contain asynchronous operations which in turn perform Mutations
import socket
import random
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
bytes = random._urandom(1024)
ip = input('Target IP Address: ')
port = int(input('Target port: '))
sent = 0
@0xch4z
0xch4z / README.md
Last active April 14, 2020 16:36
symbolication instructions
// Added Firebase
var config = {
apiKey: "AIzaSyDQ8CtOy6fZ3YXqhY--5h5iui2OgbjdGHs",
authDomain: "employee-mgmt-database.firebaseapp.com",
databaseURL: "https://employee-mgmt-database.firebaseio.com",
projectId: "employee-mgmt-database",
storageBucket: "employee-mgmt-database.appspot.com",
messagingSenderId: "390969580001"
};
@0xch4z
0xch4z / foo.js
Last active October 28, 2017 17:27
/**
* Make Query
* @param {string} term The search term
* @param {number} quantity Quantity of posts
* @param {string} startYear Optional
* @param {string} endYear Optional
* @returns {string} The query url
*/
function makeQuery(term, quantity, startYear, endYear) {
const baseUrl = 'https://api.nytimes.com/svc/search/v2/articlesearch.json';
#include <iostream>
#include <vector>
template <class T>
int binary_search(const std::vector<T> &vec, const T x) {
int left_bound, right_bound, curr;
left_bound = 0;
right_bound = vec.size() - 1;
while (left_bound <= right_bound) {
curr = (left_bound + right_bound) / 2;
#include <iostream>
#include <vector>
template <class T>
void log_vector(const std::vector<T> &vec) {
std::cout << "[" << std::endl;
for (const T el: vec) {
std::cout << '\t' << el << ',' << std::endl;
}
std::cout << "]" << std::endl;
#include <iostream>
#include <vector>
template <class T>
void bubble_sort(std::vector<T> &vec) {
bool didSwap;
do {
didSwap = false;
for (int i = 0; i < vec.size() - 1; i++) {
@0xch4z
0xch4z / thunk.js
Last active December 28, 2021 06:16
import axios from 'axios'
import uuid from 'uuid'
import { makeQuery } from '../utils'
/**
* Constants
*/
export const ADD_CITY_AND_FETCH = 'ADD_CITY_AND_FETCH'
export const FETCH_WEATHER_ALL = 'FETCH_WEATHER_ALL'