Skip to content

Instantly share code, notes, and snippets.

Avatar

Paul Damnhorns nodkz

View GitHub Profile
View gist:94b8562661fb07d6cb67
(function($, undefined) {
/**
* Unobtrusive scripting adapter for jQuery
*
* Requires jQuery 1.6.0 or later.
* https://github.com/rails/jquery-ujs
* Uploading file using rails.js
* =============================
@nodkz
nodkz / gist:ab95552a743451ec958e
Created Jul 9, 2015
Beeline в Казахстане встраивает следующий html-код на чужие сайты для пользователей IPAD на мобильном интернете. Встраивает свою рекламу, без ведома площадок.
View gist:ab95552a743451ec958e
<div id="toolbar">
<iframe id="toolBarPcFrame" src="http://192.168.240.36:8080/ets/ToolBarPcServlet" allowtransparency="true"
background-color="transparent"
style="position: fixed; z-index: 2147483640; width: 140.4px; height: 146.4px; margin: 0px; padding: 0px; bottom: 0px; right: 0px; border: none;">
<html>
<head>
<meta name="viewport"
content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=0;">
<meta name="format-detection" content="telephone=no">
<style type="text/css">
@nodkz
nodkz / app_schema.js
Last active Mar 30, 2016
Schema configuration example for commit "Create schema2.js for getting more granular schema configuration" (https://github.com/nodkz/graffiti-mongoose/commit/08aa4a394c8b53a442ec05929f1b0035418a1ae0).
View app_schema.js
// This gist is a draft solution for extending graphQL schemas generated by graffiti.
import { getSchema, addMongooseModel, getGQType, getExistedType } from 'lib/graffiti-mongoose/src/schema/schema2';
import { User } from 'app/_schema/mongoose/user';
import { Cv } from 'app/_schema/mongoose/cv';
import { UserData } from 'app/_schema/mongoose/userData';
import ExtraFieldsWrapper from 'lib/graffiti-mongoose/src/wrappers/extra-fields';
import getFieldList from 'lib/graffiti-mongoose/src/query/projection';
@nodkz
nodkz / gist:bb0f4e050448225a8346cefa7077eab8
Last active Apr 11, 2016
What reindex.io will return on DELETE? Null, empty or the previous object data.
View gist:bb0f4e050448225a8346cefa7077eab8
mutation {
deleteMovie(input: {clientMutationId:"123", id:"TW92aWU6NTZiODc5M2E4NzMwNzYxMjAwMGZhNWM2"}) {
clientMutationId
id
changedMovie {
id
title
}
changedMovieEdge {
cursor
@nodkz
nodkz / batchRelayNetworkLayer.js
Last active Apr 21, 2016
BatchRelayNetworkLayer + ExpressWrapMiddleware
View batchRelayNetworkLayer.js
/* eslint-disable prefer-template, arrow-body-style */
import 'whatwg-fetch';
// import fetchWithRetries from 'fbjs/lib/fetchWithRetries';
class AuthError extends Error {}
/**
* Rejects HTTP responses with a status code that is not >= 200 and < 300.
* This is done to follow the internal behavior of `fetchWithRetries`.
@nodkz
nodkz / compose.js
Created Jun 15, 2016
Help to annotate this function with Flow
View compose.js
/**
* Composes single-argument functions from right to left. The rightmost
* function can take multiple arguments as it provides the signature for
* the resulting composite function.
*
* @param {...Function} funcs The functions to compose.
* @returns {Function} A function obtained by composing the argument functions
* from right to left. For example, compose(f, g, h) is identical to doing
* (...args) => f(g(h(...args))).
*/
View graphql-js-on-flow27-errors.txt
src/utilities/buildASTSchema.js:257
257: locations: directiveAST.locations.map(node => node.value),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `map`
257: locations: directiveAST.locations.map(node => node.value),
^^^^^^^^^^ some string with unknown value. Property not found in
97: locations: Array<DirectiveLocationEnum>;
^^^^^^^^^^^^^^^^^^^^^ object literal. See: src/type/directives.js:97
src/utilities/buildASTSchema.js:258
258: args: makeInputValues(directiveAST.arguments),
View routes.js
import React from 'react';
import Relay from 'react-relay';
import { relayStore } from 'app/clientStores'; // relayStore = Relay.Store;
import App from 'app/_components/App/App';
import Menu from 'app/Menu/Menu';
import MainPage from 'app/MainPage/MainPage';
import Page404 from 'app/_components/Page404/Page404';
import LoadingPage from 'app/_components/LoadingPage/LoadingPage';
import BrokenPage from 'app/_components/BrokenPage/BrokenPage';
@nodkz
nodkz / relayStore.js
Last active Jun 29, 2017
relayStore with `reset` and simplified `mutate` methods
View relayStore.js
let relayStore;
function relayCreateStore() {
const env = new Relay.Environment();
env.injectNetworkLayer(new Relay.DefaultNetworkLayer('/graphql'));
if (__DEV__) {
RelayNetworkDebug.init(env);
}
env.reset = () => relayCreateStore();
env.mutate = ({
query,
View .flowconfig
[ignore]
.*/build/.*
.*/tools/.*
.*/node_modules/.*/test/.*
.*/node_modules/.*/tests/.*
.*/node_modules/ajv.*
.*/node_modules/acorn.*
.*/node_modules/async.*
.*/node_modules/babel.*
.*/node_modules/bluebird.*