Skip to content

Instantly share code, notes, and snippets.

View ldiebold's full-sized avatar

Luke Diebold ldiebold

View GitHub Profile
@ldiebold
ldiebold / open-material-design-icons-in-chrome.py
Created May 23, 2021 06:20
Autokey Script Examples - Ubuntu
import subprocess
from subprocess import call
call(['google-chrome', 'https://cdn.materialdesignicons.com/4.7.95/'])
@ldiebold
ldiebold / switch_to_chrome.py
Created September 28, 2020 01:28
AutoHotkeys - Open to, or switch to application
# Example using google chrome
import subprocess
from subprocess import call
def winexists(target):
for line in subprocess.check_output(['wmctrl', '-l', '-x']).splitlines():
window_name = line.split(None, 3)[2].decode()
if window_name == target:
return True
return False
var result = ''; var elements = document.getElementsByClassName('_2pio'); for(var i = 0; i < elements.length; i++) { result += (elements[i].innerHTML + '\n') } console.log(result)
@ldiebold
ldiebold / Comment.js
Created October 2, 2019 05:56
Files for the vuetiful life, vuex-orm series (video 18). 1. Create insertUsers.js in your "src" directory 2. update User.js, Post.js and Comment.js
import { Model } from '@vuex-orm/core'
import User from './User'
export default class Comment extends Model {
static entity = 'comments'
static fields() {
return {
id: this.increment(),
body: this.attr(null),
@ldiebold
ldiebold / flexible-request.php
Created June 5, 2019 10:11
Laravel flexible request
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ProjectBillRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
@ldiebold
ldiebold / laravel-request-flexible.php
Last active June 5, 2019 10:07
Laravel requests inflexible
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ProjectBillRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
@ldiebold
ldiebold / graphql-basic-query.js
Created August 17, 2018 03:42
basic graphql query
// query
{
hero {
name
}
}
// result
{
"data": {
@ldiebold
ldiebold / example-quiz-data.json
Last active April 17, 2018 23:41
An example of json data needed for my quiz
{
"heading": "example heading",
"questions": [
{
"question": "what is 1 + 2?",
"choices": [
{
"text": "1",
"type": "text",
"media": {
@ldiebold
ldiebold / check-environment.php
Last active April 15, 2018 23:12
Check Laravel Environment
<?php
if (App::environment('local')) {
// The environment is local
}
if (App::environment(['local', 'staging'])) {
// The environment is either local OR staging...
}
^+!c::
if WinExist("ahk_exe chrome.exe")
WinActivate, ahk_exe chrome.exe
else
Run, chrome.exe
return