Skip to content

Instantly share code, notes, and snippets.

Avatar
🤔
Always learning.

Dak Washbrook Vinlock

🤔
Always learning.
View GitHub Profile
@Vinlock
Vinlock / Check-If-All-Checked.js
Last active Sep 30, 2015
Personal Scripts / JQuery / JavaScript / Check if all of a certain class of checkboxes are checked and confirm with user it is okay for the ones not checked to be that way.
View Check-If-All-Checked.js
$('#inserting').submit(function(){
var confirms = ["true"];
// Class/Function to check if all values are the same. - http://stackoverflow.com/a/14832662
Array.prototype.allValuesSame = function() {
for(var i = 1; i < this.length; i++)
{
if(this[i] !== this[0])
@Vinlock
Vinlock / awscert
Created Sep 14, 2017
AWSCLI Cert Uploader/Generator
View awscert
#!/usr/bin/env python
import argparse, os, readline
# Check if AWS CLI is installed
if os.popen("command -v aws").read() == '':
print('AWS Command Line Interface is not installed.')
exit()
# Parse Arguments
@Vinlock
Vinlock / EditableReactiveDiv.jsx
Last active May 29, 2020
Controlled Content Editable Div
View EditableReactiveDiv.jsx
import React from 'react'
import PropTypes from 'prop-types'
const EditableReactiveDiv = (props) => {
const { value: propsValue, onChange: propsOnChange, ...rest } = props
const [currentValue, setCurrentValue] = React.useState(propsValue)
const divRef = React.useRef(null)
React.useEffect(() => {
if (document.activeElement !== divRef.current) {
@Vinlock
Vinlock / useModal.jsx
Last active Jun 17, 2021
Antd Use Modal Hook
View useModal.jsx
import React from 'react'
import ReactDOM from 'react-dom'
import { Modal } from 'antd'
const useModal = (Component, props) => {
const [open, setOpen] = React.useState(false)
const [loading, setLoading] = React.useState(false)
const onOk = props.onOk || (() => {})
const handleOk = () => {