Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View samuelstevens9's full-sized avatar

Sam Stevens samuelstevens9

View GitHub Profile
@samuelstevens9
samuelstevens9 / WIRED-ez-read.user.js
Last active July 7, 2017 14:24
GreaseMonkey Script to make WIRED Easy to Read
// ==UserScript==
// @name Wired Easy Read
// @namespace samuelstevens9
// @include https://www.wired.com/story/*
// @include https://www.wired.com/\d+?/\d+?/.*
// @version 1
// @grant none
// ==/UserScript==
var arts = document.getElementsByTagName('article');
var bge = document.createElement('div');
@samuelstevens9
samuelstevens9 / post_slack.py
Created June 16, 2017 19:55
Python Requests Post Slack Message
"""
https://api.slack.com/incoming-webhooks#sending_messages
{
"text":"Read <https://api.slack.com/incoming-webhooks#sending_messages|Send Slack Message> for more details @slackuser #general"
"link_names": 1
}
"""
import requests,json
def slack_message(message_text=None,payload_obj=None,slack_url=None):
if(not slack_url):
@samuelstevens9
samuelstevens9 / video2gif.md
Last active February 28, 2018 19:37
video2gif: simple command line tool using ffmpeg to convert a video to a gif

FFMPEG

Install FFMPEG Mac

$ brew install ffmpeg

Add video2gif to ~/.bash_profile

@samuelstevens9
samuelstevens9 / AngularFirebase-Reference-Notes.md
Last active March 10, 2018 19:14
AngularFirebase Reference & Notes

My Notes on Typescript and AngularFirebase

Read & Manipulate A Document: i.e. Increment

Some Notes:

  • Need to import take and do from rxjs.
  • Use snapeshotChanges() instead of valueChanges()
  • take(1) so you do not end up in an infinite loop since you are editing the same object you are reading
  • DO NOT FORGET .subscribe() at the end.
@samuelstevens9
samuelstevens9 / DragAndResize.jsx
Created April 23, 2018 18:24
React Drag and Resize Component
import React from "react"
import { DragDropContainer } from 'react-drag-drop-container';
import { Resizable, ResizableBox } from 'react-resizable';
export default class DragAndResize extends React.Component {
constructor(props) {
super(props)
this.state = {
noDragging:false,
clipperWidth:100,
@samuelstevens9
samuelstevens9 / aws_eb_select_app_versions.js
Created August 24, 2018 03:26
AWS EB Application Versions Select From Bottom Console JS
/**
If you Ever receive the following error from AWS Elastic Beanstalk:
"com.amazonaws.services.elasticbeanstalk.model.TooManyApplicationVersionsException:
You cannot have more than 1000 Application Versions. Either remove some Application Versions or request a limit increase. "
And you want to delete several versions at once but don't want to click all day, open the JavaScript console and script it!
Probably a way to script it using AWS CLI...
*/
var cb = document.querySelectorAll("input[type=checkbox]");
for(var e = 1; e < 100; e++){ cb[cb.length-e].click(); }
@samuelstevens9
samuelstevens9 / setupProxy.js
Created February 11, 2019 21:21
Simple setupProxy.js for CRA
// src/setupProxy.js
const proxy = require('http-proxy-middleware')
const pkg = require('../package.json')
const target = process.env.PROXY || pkg.proxy
// tslint:disable-next-line:no-console
console.log("setupProxy",target);
module.exports = function(app) {
// app.use(proxy({ target }));
app.use(proxy('/api', {