Skip to content

Instantly share code, notes, and snippets.

View lanwin's full-sized avatar
🤡
-

Steve Wagner lanwin

🤡
-
View GitHub Profile
@lanwin
lanwin / graphql-tag-source.ts
Created March 23, 2020 09:41
This is a simplified version of graphql-tag whish only outputs the source of each graphql query instead of a documentNode.
// Copyright 2020 Steve Wagner
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE US
declare module "react-copy-write" {
interface ConsumerProps<TState> {
select?: any;
children: (store: TState) => any;
}
interface ISelector<TState, TRet> {
select: (store: TState) => TRet;
}

Keybase proof

I hereby claim:

  • I am lanwin on github.
  • I am lanwin (https://keybase.io/lanwin) on keybase.
  • I have a public key whose fingerprint is 1B62 8305 FF00 2CB8 6832 1498 B14D EC8D 81B8 000B

To claim this, I am signing this object:

@lanwin
lanwin / index.html
Created June 7, 2016 07:21
Redux devtools extension with mori
<!DOCTYPE html>
<html>
<body>
<script src="/node_modules/redux/dist/redux.js" type="text/javascript"></script>
<script src="/node_modules/mori/mori.js" type="text/javascript"></script>
<script type="text/javascript">
"use strict";
function reducer(){
return mori.hashMap('key','value');
@lanwin
lanwin / functional-utils.js
Created September 29, 2015 14:30 — forked from bendc/functional-utils.js
A set of pure and immutable ES2015 functions aimed to make functional JavaScript more idiomatic.
// array utils
// =================================================================================================
const combine = (...arrays) => [].concat(...arrays);
const compact = arr => arr.filter(Boolean);
const contains = (() => Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)
@lanwin
lanwin / test.html
Created April 23, 2015 10:28
Endless XMLHttpRequest leaves a tmp file for every request when responseType = 'blob' is set # 3
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script type="text/javascript">
function onload(s) {
@lanwin
lanwin / example.html
Created April 20, 2015 11:51
Endless XMLHttpRequest leaves a tmp file for every request when responseType = 'blob' is set
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script type="text/javascript">
function func() {
@lanwin
lanwin / designer.html
Last active August 29, 2015 14:18
designer
<link href="../core-icon-button/core-icon-button.html" rel="import">
<link href="../core-toolbar/core-toolbar.html" rel="import">
<link href="../core-header-panel/core-header-panel.html" rel="import">
<link href="../core-drawer-panel/core-drawer-panel.html" rel="import">
<link href="../core-menu/core-submenu.html" rel="import">
<link href="../core-item/core-item.html" rel="import">
<polymer-element name="my-element">
<template>
@lanwin
lanwin / gist:ad98f0b37222b4f08478
Created April 9, 2015 09:45
XMLHttpRequest leaves a tmp file for every request when responseType = 'blob' is set
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script type="text/javascript">
for(var i=0;i<10;i++) {
@lanwin
lanwin / convert.js
Created February 9, 2015 16:09
Parse tshark (Wireshark) data field capture file
var fs = require("fs");
var content = fs.readFileSync("outfile.raw",{encoding:'ascii'}).toString().trim().split(/\r?\n/g);
var text = Buffer.concat(content.map(function(line){return new Buffer(line.trim(),'hex');})).toString('ascii').trim();
text.split(/\r\n\r\n/g).forEach(function(line){
var obj = JSON.parse(line);
console.log( ' ' );
console.log( JSON.stringify(obj,null,line.length>200?2:0) );