Skip to content

Instantly share code, notes, and snippets.

View lorensr's full-sized avatar

Loren ☺️ lorensr

View GitHub Profile
@josemarluedke
josemarluedke / from-introspection-schema-result-to-graphql-sdl.js
Created April 3, 2019 14:31
Generate a SDL graphql string from a introspection schema result
const { buildClientSchema, printSchema } = require('graphql');
const fs = require('fs');
const introspectionSchemaResult = JSON.parse(
fs.readFileSync('./graphql.schema.json')
);
const graphqlSchemaObj = buildClientSchema(introspectionSchemaResult);
const sdlString = printSchema(graphqlSchemaObj);
@kentcdodds
kentcdodds / package-exact.js
Last active February 2, 2024 12:08
make your package.json dependencies be the exact version that's in your node_modules currently
/* jshint node:true */
/* eslint-env node */
/*
* This will look at the current version of all of your dependencies and update your package.json
* with the specific version that you currently have in node_modules. This will save you from the
* sadness that is: DEPENDENCY MANAGEMENT
*
* Place this file in a folder that's a a sibling to your package.json and node_modules
* Then simply run: node scripts/package-strict
(function($){
var insertAtCaret = function(value) {
if (document.selection) { // IE
this.focus();
sel = document.selection.createRange();
sel.text = value;
this.focus();
}
else if (this.selectionStart || this.selectionStart == '0') {
var startPos = this.selectionStart;
@clintel
clintel / gist:1155906
Created August 19, 2011 02:40
Fenced code in bullet lists with GitHub-flavoured MarkDown??

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code
    
@mads-hartmann
mads-hartmann / Coffeescript ctags
Created April 7, 2011 07:44
ctags definitions for Coffeescript. Very basic for now. "> ctags -e -R source_folder" and then M-. to jump to the definition of any function or variable (if you're using emacs)
--langdef=coffee
--langmap=coffee:.coffee
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=.*->.*$/\1/f,function/
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=[^->\n]*$/\1/v,variable/