Skip to content

Instantly share code, notes, and snippets.

View cwardzala's full-sized avatar
🏠
Working from home

Cameron Wardzala cwardzala

🏠
Working from home
View GitHub Profile
@brunolemos
brunolemos / linkedin-unfollow-everyone.js
Last active February 3, 2024 05:47
Unfollow everyone on Linkedin
(() => {
let count = 0;
function getAllButtons() {
return document.querySelectorAll('button.is-following') || [];
}
async function unfollowAll() {
const buttons = getAllButtons();
@yangshun
yangshun / docusaurus-copy-button.md
Last active April 4, 2023 07:07
How to add the "Copy" button to code blocks in Docusaurus

Adding "Copy" (to Clipboard) Button

If you would like to add a button to your fenced code blocks so that users may copy the code, you can do so in Docusaurus. You will have to add some code to your Docusaurus project, as seen below.

Under static/js, create a file called code-block-buttons.js with the following:

// Turn off ESLint for this file because it's sent down to users as-is.
/* eslint-disable */
window.addEventListener('load', function() {
@rcoh
rcoh / otp.py
Last active August 17, 2023 08:03
An implementation of Google Authenticator Compatible 2-factor Codes
"""
An implementation of TOTP as described in https://tools.ietf.org/html/rfc6238#section-4 aka Google Authenticator Style 2-factor Auth
"""
import base64
import datetime
import hashlib
import hmac
import sys
import struct
import time
var Queue = (()=>{
const map = new WeakMap();
let _items = []
class Queue{
constructor(...items){
//initialize the items in queue
map.set(this, []);
_items = map.get(this);
// enqueuing the items passed to the constructor
this.enqueue(...items)
<?php
namespace App\Services;
use App\Post;
class Slug
{
/**
* @param $title
@svapreddy
svapreddy / CalendarMonth.js
Last active February 15, 2023 05:57
A small util to generate Calendar Model for any given month and Year
/* Expects month to be in 1-12 index based. */
var monthInformation = function(year, month){
/* Create a date. Usually month in JS is 0-11 index based but here is a hack that can be used to calculate total days in a month */
var date = new Date(year, month, 0);
/* Get the total number of days in a month */
this.totalDays = date.getDate();
/* End day of month. Like Saturday is end of month etc. 0 means Sunday and 6 means Saturday */
this.endDay = date.getDay();
date.setDate(1);
/* Start day of month. Like Saturday is start of month etc. 0 means Sunday and 6 means Saturday */
@claytongulick
claytongulick / Zen of Javascript
Last active September 14, 2022 16:55
Zen Of Javascript
Zen Of Javascript
Build functionality, not architecture.
Build small things that work
and glue them together to make big things.
Clear is better than clever,
but graceful beats both.
Comments are good, even if you're Dutch.
Asychronous is better than synchronous
except for when it isn't
@mixin screen-sizes($sizes...) {
$media-query: "only screen and";
$query: nil;
@if length($sizes) == 1 {
$size: nth($sizes, 1);
@if $size == small {
$query: "#{small-screen(start)} AND #{small-screen(end)}";
} @else if $size == medium {
$query: "#{medium-screen(start)} AND #{medium-screen(end)}";
} @else if $size == large {
@maxrice
maxrice / us-state-names-abbrevs.php
Created May 23, 2012 18:32
US State Names & Abbreviations as PHP Arrays
<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
'AL'=>'ALABAMA',
'AK'=>'ALASKA',
'AS'=>'AMERICAN SAMOA',
'AZ'=>'ARIZONA',
'AR'=>'ARKANSAS',
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",