Skip to content

Instantly share code, notes, and snippets.

View JohnRiv's full-sized avatar
👋
Hello!

John Riviello JohnRiv

👋
Hello!
View GitHub Profile
@mdb
mdb / gist:4288296
Last active October 25, 2022 12:17
How to Amend a Commit
# View the log to find the commit you want to edit:
git log
# Quit out of the log
q
# Rebase from the commit you want to edit, in interactive mode:
git rebase SOME_COMMIT_ID^ --interactive
# This will open an interactive menu in Vi
@slightlyoff
slightlyoff / push_payloads_userland.md
Last active September 30, 2022 23:11
Delivering H/2 Push Payloads To Userland

Background

One of the biggest missed opportunities thus far with HTTP/2 ("H/2") is that we are not yet able to sunset WebSockets in favor of H/2. Web Sockets and H/2 both support multiplexing messages bi-directionally and can send both textual and binary data.

Server Sent Events ("SSE"), by contrast, are not bi-directional (they're a "server-push-only" channel) and binary data cannot be sent easily. They are, however, very simple to implement. Adding to the menagerie of options, RTCPeerConnection can also be used to signal data to applications in a low-latency (but potentially lossy) way.

Because H/2 [does not support the handshake (upgrade) that WebSockets use to negotiate a connection](https://daniel.haxx.se/blog/2016/06/15/no-websockets-

@mikeyk
mikeyk / redis_session_backend.py
Created April 8, 2011 18:01
A redis backend for Django Sessions, tested on Django 1.3+
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(
@kevinpschaaf
kevinpschaaf / 0. Custom Elements + Redux toolbox & examples.md
Last active July 21, 2020 06:48
Custom Elements + Redux toolbox & examples

An approach to binding Redux to custom elements

The code here captures some of the patterns I used in the "real estate" demo app discussed in my talk End to End Apps with Polymer from Polymer Summit 2017.

There are many ways to connect Redux to custom elements, and this demonstrates just one pattern. The most important aspects are to try and lazily-load as much of the otherwise global state management logic along with the components that need them (as shown via the lazyReducerEnhancer and addReducers calls in the connected components), and to consider the tradeoffs you make in terms of coupling components to the store.

The pattern shown here of creating a stateless component and then a subclass that connects it to the store addresses a potential desire to reuse app-level stateless components between more than one application context, so the subclass provides a degree of decoupling from the concrete store, at the expense of more boilerplate. If app com

@Rich-Harris
Rich-Harris / README.md
Created November 24, 2017 16:44
how svelte/store could work

Bear with me while I think aloud about this (please comment there, not here!). Goals:

  • Minimal boilerplate
  • Familiar API
  • Preserve Svelte's built-in optimisations
  • Support use cases like hot-reloading and custom devtools

Let's start with a single store that is external to the component tree. Our top-level <App> component connects to it:

@marcamos
marcamos / Gruntfile.js
Last active January 16, 2018 19:51
Learning Grunt by writing a verbose Gruntfile that replaces (and, goes beyond) what we're used to with CodeKit.
module.exports = function(grunt) {
"use strict";
// -------------------------------------------------------------------------
// #### Load plugins as needed ####
// Using a 'just in time' approach -- meaning: only load plugins when they
// are needed -- this will automatically find, then load, any and all
// plugins that are needed by the task currently being executed. It will
// scan the devDependencies object, in package.json, and match any of the
[alias]
outdated = "!f() { bash -c 'diff -u <(git branch --no-merged master) <(git branch --contains master) | egrep \"^- \"'; }; f"
update = "!f() { set -e; git checkout $1; git rebase master; git push -f origin $1; git checkout -; }; f"
@airportyh
airportyh / jsconf_slides_codes_and_notes.md
Last active June 19, 2017 20:51
JSConf 2014 Slides, Codes and Notes.

JSConf Slides, Codes and Notes

These are all the JSConf 2014 slides, codes, and notes I was able to cull together from twitter. Thanks to the speakers who posted them and thanks to @chantastic for posting his wonderful notes.

Modular frontend with NPM - Jake Verbaten (@Raynos)

@metaskills
metaskills / info.md
Last active July 26, 2016 23:16
Sassmeister Presenter Bookmarklets

Presenter Mode

This bookmarklet will put Sassmeister into presenter mode. I used it for screenshots for my talk.

javascript:(function(){var%20h,m,f;h=$('.site_header'),m=$('.main_body'),f=$('footer');if(h.is(':visible')){h.hide();m.css({top:0,bottom:0});f.hide();}else{h.show();m.css({top:'3.33333em',bottom:'1.77778em'});f.show()}}());

presenter-mode

Presenter Mode Zoomed

@asolove
asolove / fixWebFonts.js
Created March 14, 2014 17:59
Fix Chrome WebFonts painting bug
(function(){
function brieflyAddCss(cssCode) {
var styleElement = document.createElement("style");
styleElement.type = "text/css";
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = cssCode;
} else {
styleElement.appendChild(document.createTextNode(cssCode));
}
document.head.appendChild(styleElement);