Skip to content

Instantly share code, notes, and snippets.

View olalonde's full-sized avatar

Oli olalonde

View GitHub Profile
import { createAction } from 'redux-actions';
import * as WebUtils from '../webUtils/index';
import {
SELECT_MEAL,
UPDATE_MEAL_PROP,
BEGIN_CREATING_MEAL,
SUCCESS_CREATING_MEAL,
ERROR_CREATING_MEAL,
BEGIN_LOADING_MEALS,
@OlegIlyenko
OlegIlyenko / Event-stream based GraphQL subscriptions.md
Last active May 28, 2024 17:41
Event-stream based GraphQL subscriptions for real-time updates

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

@ralphschindler
ralphschindler / README.md
Last active May 1, 2024 19:14
Docker For Mac Host Address Alias To Enable PHP XDebug (10.254.254.254 Trick)

Docker (Mac) De-facto Standard Host Address Alias

This launchd script will ensure that your Docker environment on your Mac will have 10.254.254.254 as an alias on your loopback device (127.0.0.1). The command being run is ifconfig lo0 alias 10.254.254.254.

Once your machine has a well known IP address, your PHP container will then be able to connect to it, specifically XDebug can connect to it at the configured xdebug.remote_host.

Installation Of IP Alias (This survives reboot)

Copy/Paste the following in terminal with sudo (must be root as the target directory is owned by root)...

const {
topLevel: {
intermediate, // declaration of intermediate
intermediate: {
nested // declaration of nested
}
}
} = {
topLevel: {
intermediate: {
anonymous
anonymous / index.js
Created December 17, 2016 03:09
app
.use('/users', new Router()
.use('/:username', new Router()
.get('/', users.show)
// want to add authorization just for update/delete? sure buddy
.use(userIsAdminMiddleware)
.put('/', users.update)
.del('/', users.destroy)
)
.get('/', users.list)
anonymous
anonymous / example.js
Created December 17, 2016 03:15
const userRouter = new Router()
.get('/', users.show)
.use(userIsAdminMiddleware)
.put('/', users.update)
.del('/', users.destroy)
app
.use('/users', new Router()
.use('/:username', userRouter)
.get('/', users.list)
@yocontra
yocontra / aoe2hd.md
Last active June 9, 2023 18:28
Age of Empires II HD - For Mac OSX
@smeschke
smeschke / gist:df2c5794287fa7044817dc3e00d61351
Last active February 22, 2023 01:21
Using Keras from the Webcam
import cv2, numpy as np, os
#parameters
working_dir = '/home/stephen/Desktop/keras_demo/'
cap = cv2.VideoCapture(0)
org, font, scale, color, thickness, linetype = (50,50), cv2.FONT_HERSHEY_SIMPLEX, 1.2, (234,12,123), 2, cv2.LINE_AA
#chromakey values
h,s,v,h1,s1,v1 = 16,0,64,123,111,187 #green
h,s,v,h1,s1,v1 = 0,74,53,68,181,157 #skin tone
@chenshaoju
chenshaoju / script running adb shell
Last active March 25, 2024 04:58
Android 8.x Captive Portal Server for Mainland China
settings put global captive_portal_mode 1
settings put global captive_portal_use_https 1
settings put global captive_portal_http_url http://connect.rom.miui.com/generate_204
settings put global captive_portal_https_url https://connect.rom.miui.com/generate_204
settings put global captive_portal_fallback_url http://captive.v2ex.co/generate_204
settings put global captive_portal_other_fallback_urls http://www.google.cn/generate_204
// First 21-digit prime number found in consecutive digits of e
// answer:
// 957496696762772407663
//
// in hexadecimal:
// 33E7EF9CABBAF6C56F
const bitcore = require("bitcore-lib");
const { PrivateKey, HDPrivateKey } = bitcore;