Skip to content

Instantly share code, notes, and snippets.

🤡
-

Steve Wagner lanwin

🤡
-
View GitHub Profile
@lanwin
lanwin / graphql-tag-source.ts
Created Mar 23, 2020
This is a simplified version of graphql-tag whish only outputs the source of each graphql query instead of a documentNode.
View graphql-tag-source.ts
// 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
View react-copy-write-typings.ts
declare module "react-copy-write" {
interface ConsumerProps<TState> {
select?: any;
children: (store: TState) => any;
}
interface ISelector<TState, TRet> {
select: (store: TState) => TRet;
}
View keybase.md

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 Jun 7, 2016
Redux devtools extension with mori
View index.html
<!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 Sep 29, 2015 — forked from bendc/functional-utils.js
A set of pure and immutable ES2015 functions aimed to make functional JavaScript more idiomatic.
View functional-utils.js
// 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 Apr 23, 2015
Endless XMLHttpRequest leaves a tmp file for every request when responseType = 'blob' is set # 3
View test.html
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script type="text/javascript">
function onload(s) {
@lanwin
lanwin / example.html
Created Apr 20, 2015
Endless XMLHttpRequest leaves a tmp file for every request when responseType = 'blob' is set
View example.html
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script type="text/javascript">
function func() {
View designer.html
<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 Apr 9, 2015
XMLHttpRequest leaves a tmp file for every request when responseType = 'blob' is set
View gist:ad98f0b37222b4f08478
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script type="text/javascript">
for(var i=0;i<10;i++) {
@lanwin
lanwin / convert.js
Created Feb 9, 2015
Parse tshark (Wireshark) data field capture file
View convert.js
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) );
You can’t perform that action at this time.