Skip to content

Instantly share code, notes, and snippets.

View usingthesystem's full-sized avatar

Markus Müller usingthesystem

View GitHub Profile
@usingthesystem
usingthesystem / sse.html
Created July 1, 2023 04:16 — forked from Deele/sse.html
Server-Sent Events example, Javascript client-side, PHP server-side
<html>
<body>
<div id="result"></div>
<script>
if (typeof(EventSource) !== 'undefined') {
console.info('Starting connection...');
var source = new EventSource('/stream.php');
source.addEventListener('open', function(e) {
console.info('Connection was opened.');
}, false);
@usingthesystem
usingthesystem / export-sync-bookmarks.js
Created June 18, 2023 10:46 — forked from ilokhov/export-sync-bookmarks.js
Node.js script for exporting and synchronising bookmarks from Google Chrome
const fs = require("fs");
const path = require("path");
function newItem(name, url) {
return { name, url };
}
const bookmarkPath = path.join(
process.env.HOME,
"/Library/Application Support/Google/Chrome/Default/Bookmarks"
#!/usr/bin/env bash
googlechromebookmarks() {
cat ~/.config/google-chrome/Default/Bookmarks | \
grep -E '\"name|\"url' | \
grep -vE '\"type\"\:' | \
awk '{print $1 substr($0,index($0,$2))}' | \
sed s'/^\"name\"\:/title \= /' | \
sed s'/^\"url\"\:/url \= /' | \
sed s'/\,$//' | \
@usingthesystem
usingthesystem / injected.js
Created June 11, 2021 15:48 — forked from uxter/injected.js
How to inject custom JavaScript in web page? (simple google chrome plugin)
// Your code
<?php
/**
* Plugin Name: TOPTAL WP-CLI Commands
* Version: 0.1
* Plugin URI: https://n8finch.com/
* Description: Some rando wp-cli commands to make life easier...
* Author: Nate Finch
* Author URI: https://n8finch.com/
* Text Domain: toptal-wpcli
* Domain Path: /languages/
@usingthesystem
usingthesystem / README.md
Created March 20, 2020 12:11 — forked from hofmannsven/README.md
Storing WordPress files and database with WP-CLI on the server.
@usingthesystem
usingthesystem / git-remove-branches
Created December 11, 2019 03:00 — forked from TBonnin/git-remove-branches
Safely remove local fully merged branches
#!/bin/bash
# This has to be run from master
git checkout master
# Update our list of remotes
git fetch
git remote prune origin
# Remove local fully merged branches
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var domStyle = document.createElement("style");
domStyle.append(
'* { color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }\
* * { background-color: rgba(0,255,0,.2) !important; }\
* * * { background-color: rgba(0,0,255,.2) !important; }\
* * * * { background-color: rgba(255,0,255,.2) !important; }\
* * * * * { background-color: rgba(0,255,255,.2) !important; }\
@usingthesystem
usingthesystem / spinner.js
Created August 17, 2019 05:29 — forked from fritzy/spinner.js
Use Mutation Observers to place image placeholders (spinners) on loading images within a target element.
//whenever uncached images are added to the dom tree within target,
//replace them with a spinner gif until they're loaded
function replaceImages(target, spinner_src) {
var spinner, observer;
//detect support
if (window.MutationObserver) {
//preload spinner (probably a gif)
//if it's not ready for first use, oh well
spinner = new Image();
@usingthesystem
usingthesystem / README.md
Created July 27, 2018 02:48 — forked from obahareth/README.md
GitHub GraphQL API Starred Repositories With Pagination

GitHub GraphQL API Starred Repositories Examples With Pagination

You can play with the GraphQL API live here. It's pretty nice and has autocompletion based on the GraphQL schema.

The first example gets your first 3 starred repos, the cursor values can be used for pagination.

Here's an example response from the first query:

{