Skip to content

Instantly share code, notes, and snippets.

View psenger's full-sized avatar
:octocat:
Makin Bacon

Philip A Senger psenger

:octocat:
Makin Bacon
View GitHub Profile
@psenger
psenger / add_remove_class_with_js.md
Last active March 15, 2020 02:46 — forked from egeorjon/add_remove_class_with_js.md
[Add or Remove css class with Javascript] #css

From: StackOverflow

To change all classes for an element:

document.getElementById("MyElement").className = "MyClass";

To add an additional class to an element:

document.getElementById("MyElement").className += " MyClass";

To remove a class from an element:

@psenger
psenger / react-with-context.js
Last active October 29, 2020 22:34 — forked from hipertracker/react-with-context.js
[Example of using React context for ES6 classes] #ReactJs #JavaScript
import React, { PropTypes } from 'react';
@reactor
class Child extends React.Component {
componentDidMount() {
console.log('Child mounted with context reactor:', this.context.reactor);
}
render() {
return <span>Child Component</span>;
}
@psenger
psenger / ultimate-ut-cheat-sheet.md
Last active February 6, 2020 23:43 — forked from yoavniran/ultimate-ut-cheat-sheet.md
[The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon] #JavaScript #TestHelper

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies


@psenger
psenger / 1-restify-server-cheatsheet.js
Last active October 6, 2020 00:10 — forked from LeCoupa/1-restify-server-cheatsheet.js
[Restify CheatSheet] #RESTify #JavaScript
// Restify Server CheatSheet.
// See: http://journal.gentlenode.com/node-3-restify-cheatsheet/
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
@psenger
psenger / runner.py
Last active February 8, 2023 15:24 — forked from ari-vedant-jain/Unzipping using Python & Pyspark
[Unzipping using Python & Pyspark] #Python #Spark #Pyspark
# Using Python
import os, zipfile
z = zipfile.ZipFile('/databricks/driver/D-Dfiles.zip')
for f in z.namelist():
if f.endswith('/'):
os.makedirs(f)
# Reading zipped folder data in Pyspark
@psenger
psenger / services.markdown
Last active March 15, 2020 02:40 — forked from rwilcox/services.markdown
[How to create a new gist from OS X Service] #git #MacOS

How to create a Public Gist Service:

Step 0: Open Automator, New Service.

Step 1: Drag out Run Shell Script action. Pass Input to STDIN

Step 2: This code:

open `gist`
@psenger
psenger / setup-avahi.sh
Last active September 3, 2020 02:20 — forked from davisford/setup-avahi.sh
[Setup avahi-daemon on Ubuntu for so you can reach hostname `ubuntu.local` from host OS] #Unix #picker
## AVAHI is a whay of ZeroConf and the host name will be discovered by the clients in the network
sudo apt-get install avahi-daemon avahi-discover avahi-utils libnss-mdns mdns-scan
@psenger
psenger / mysql_cheat_sheet.md
Last active October 18, 2020 02:49 — forked from bradtraversy/mysql_cheat_sheet.md
[MySQL Cheat Sheet] #MySQL

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@psenger
psenger / make-animated-gifs-using-ffmpeg.md
Created August 30, 2021 02:14 — forked from gka/make-animated-gifs-using-ffmpeg.md
how to make a nice GIF from png frames

Make sure ffmpeg is up-to-date:

brew update
brew upgrade ffmpeg

Convert a MOV into frames. Tweak the 2/1 if you want more or fewer frames.

<script>
// Based on code from https://stackoverflow.com/questions/59629947/how-do-i-load-an-external-js-library-in-svelte-sapper
import { onMount, createEventDispatcher } from "svelte";
const dispatch = createEventDispatcher();
export let src;
export let libraryDetectionObject;
let script;
onMount(() => {