Skip to content

Instantly share code, notes, and snippets.

View andreialecu's full-sized avatar

Andrei Alecu andreialecu

View GitHub Profile
var vm = require('vm'),
code = 'var square = n * n;',
fn = new Function('n', code),
script = vm.createScript(code),
sandbox;
n = 5;
sandbox = { n: n };
benchmark = function(title, funk) {
@andreialecu
andreialecu / gist:3b47aee787cc5542d83a
Last active August 29, 2015 14:14
chosen.js pre-fix
/*!
Chosen, a Select Box Enhancer for jQuery and Prototype
by Patrick Filler for Harvest, http://getharvest.com
Version 1.3.0
Full source at https://github.com/harvesthq/chosen
Copyright (c) 2011-2015 Harvest http://getharvest.com
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
This file is generated by `grunt build`, do not edit it by hand.
@andreialecu
andreialecu / gist:a563c9a5ab7fdd7dc02f
Last active December 7, 2015 14:07
deployd heroku
// require deployd
var deployd = require('deployd');
// configure database etc.
var server = deployd({
port: process.env.PORT || 1337,
env: 'production',
db: { connectionString: process.env.MONGO_URL }
});
/*!
* angular-translate - v2.7.0 - 2015-04-26
* http://github.com/angular-translate/angular-translate
* Copyright (c) 2015 ; Licensed MIT
*/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module unless amdModuleId is set
define([], function () {
return (factory());
/*!
* angular-translate - v2.7.0 - 2015-04-25
* http://github.com/angular-translate/angular-translate
* Copyright (c) 2015 ; Licensed MIT
*/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module unless amdModuleId is set
define([], function () {
return (factory());
@andreialecu
andreialecu / delete.js
Created May 14, 2016 18:36
deployd redis caching
if(!ctx.server.redisClient) {
var redis = require('redis');
ctx.server.redisClient = redis.createClient(global.process.env.REDIS_URL);
}
if (!internal || !query.key) return;
//console.log('cache deleting', query.key);
ctx.server.redisClient.del(query.key, function(err) {
@andreialecu
andreialecu / server.js
Last active November 4, 2016 14:09
Using deployd with redis
var deployd = require('deployd');
var redisAdapter = require('socket.io-redis');
var redis = require('redis');
// need two client pairs because one is used for socket.io and the other for sessions
// might not be necessary anymore, see https://github.com/socketio/socket.io-redis/issues/90
var pub = redis.createClient(process.env.REDIS_URL);
var sub = redis.createClient(process.env.REDIS_URL, { 'return_buffers': true });
@andreialecu
andreialecu / on get.js
Last active November 16, 2016 23:32
dpd redis cache
if(!ctx.server.redisClient) {
var redis = require('redis');
ctx.server.redisClient = redis.createClient(global.process.env.REDIS_URL);
}
if (!internal || !query.key) return;
//console.log('cache getting', query.key);
$addCallback();
ctx.server.redisClient.get(query.key, function(err, value) {
@andreialecu
andreialecu / .yarnrc.yml
Created January 23, 2020 11:39
yarn v2 package extensions for some popular packages, mostly graphql and angular
packageExtensions:
"@agm/core@*":
peerDependencies:
rxjs: "*"
"@angular/cdk@*":
peerDependencies:
rxjs: "*"
"@angular/material@*":
peerDependencies:
"@angular/platform-browser": "*"
This file has been truncated, but you can view the full file.
diff --git a/node_modules/@graphql-codegen/visitor-plugin-common/index.cjs.js b/node_modules/@graphql-codegen/visitor-plugin-common/index.cjs.js
index 71d9f92..d25561d 100644
--- a/node_modules/@graphql-codegen/visitor-plugin-common/index.cjs.js
+++ b/node_modules/@graphql-codegen/visitor-plugin-common/index.cjs.js
@@ -803,12 +803,34 @@ class OperationVariablesToObject {
}
return null;
}
- transform(variablesNode) {
+ transform(variablesNode, selectionSet) {