Skip to content

Instantly share code, notes, and snippets.

Avatar

Sam Stevens samuelstevens9

  • Evansville, IN
View GitHub Profile
@samuelstevens9
samuelstevens9 / setupProxy.js
Created Feb 11, 2019
Simple setupProxy.js for CRA
View setupProxy.js
// 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', {
@samuelstevens9
samuelstevens9 / aws_eb_select_app_versions.js
Created Aug 24, 2018
AWS EB Application Versions Select From Bottom Console JS
View aws_eb_select_app_versions.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 / DragAndResize.jsx
Created Apr 23, 2018
React Drag and Resize Component
View DragAndResize.jsx
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 / AngularFirebase-Reference-Notes.md
Last active Mar 10, 2018
AngularFirebase Reference & Notes
View AngularFirebase-Reference-Notes.md

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 / video2gif.md
Last active Feb 28, 2018
video2gif: simple command line tool using ffmpeg to convert a video to a gif
View video2gif.md

FFMPEG

Install FFMPEG Mac

$ brew install ffmpeg

Add video2gif to ~/.bash_profile

@samuelstevens9
samuelstevens9 / post_slack.py
Created Jun 16, 2017
Python Requests Post Slack Message
View post_slack.py
"""
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 / WIRED-ez-read.user.js
Last active Jul 7, 2017
GreaseMonkey Script to make WIRED Easy to Read
View WIRED-ez-read.user.js
// ==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');
You can’t perform that action at this time.