Skip to content

Instantly share code, notes, and snippets.

Peter M. Elias petermelias

Block or report user

Report or block petermelias

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View example_org_kv_store_gql__package.json
{
"name": "gql-kv-type",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
View example_org_kv_store_gql.js
'use strict';
const koa = require('koa');
const koaMnt = require('koa-mount');
const koaGQL = require('koa-graphql');
const graphql = require('graphql');
const language = require('graphql/language');
const {
GraphQLSchema,
@petermelias
petermelias / noderdkafka-consumer-perf.js
Created Feb 1, 2018
noderdkafka consumer performance test
View noderdkafka-consumer-perf.js
'use strict';
const { performance: perf } = require('perf_hooks');
const kafka = require('node-rdkafka');
const clientId = 'pelias-test-client';
const groupId = 'pelias-test-cg';
const testTopic = 'pelias-test-perf-topic';
const ENV = process.env.ENV || 'local';
@petermelias
petermelias / noderdkafka-consumer-state.js
Last active Feb 1, 2018
noderdkafka state test harness
View noderdkafka-consumer-state.js
'use strict';
const kafka = require('node-rdkafka');
const { CODES: { ERRORS: {
ERR__ASSIGN_PARTITIONS,
ERR__REVOKE_PARTITIONS
}}} = kafka;
const clientId = 'pelias-test-client';
const groupId = 'pelias-test-cg';
@petermelias
petermelias / nrdkafka-consumer-test.js
Last active Jan 25, 2018
node-rdkafka consumer connect/disconnect test permutations
View nrdkafka-consumer-test.js
'use strict';
const kafka = require('node-rdkafka');
const { CODES: { ERRORS: {
ERR__ASSIGN_PARTITIONS,
ERR__REVOKE_PARTITIONS
}}} = kafka;
const clientId = 'test-client';
const groupId = 'test-cg';
@petermelias
petermelias / frameworks.js
Created May 2, 2015
Knowing your framework code
View frameworks.js
// Selecting an element by its ID
// jQuery
var myElement = $('#myElement');
// Without jQuery
var myElement = document.getElementyById('myElement');
// In the jQuery source code, the logic for selecting elements is actually far more complex.
// Worth looking at if you want to challenge yourself.
@petermelias
petermelias / diane.sql
Created Jan 23, 2015
SQL Example for Diane
View diane.sql
SELECT t2.email, t1.*
FROM all_email_history AS t1
JOIN all_email AS t2 ON t1.all_email_id = t2.id
WHERE t1.[action] IN (1, 7, 8, 9)
AND t1.created_at >= '10/22/2014';
@petermelias
petermelias / dale.sass
Created Dec 18, 2014
Abstract SASS construction using the "inside out" approach.
View dale.sass
$my-font-family: Helvectica, sans-serif
$some-other-family: Arial, sans-serif
// Typography
%standard-font-family
font-family: $my-font-family
%alternate-font-family
font-family: $some-other-family
@petermelias
petermelias / gulp-haml-build.js
Last active Nov 10, 2015
Using Gulp to build HAML files with exec instead of trying to use plugins with shitty Node Haml libraries.
View gulp-haml-build.js
gulp.task('build-css', ['clean-css'], function (done) {
cp.exec('sass -r sass-globbing src/sass/style.sass src/css/sass.css', function (error, stdout, stderr) {
if (stderr) {
console.log(stderr);
}
gulp.src(cssSrcGlob)
.pipe(plugins.concat('app.css'))
.pipe(gulp.dest('dist'))
.on('end', function () {
@petermelias
petermelias / conditional_dependency.py
Last active Feb 7, 2018
This is an example showing how to do conditional dependency loading in Python. It also demonstrates that extras_requires entries take precedence over the sub-dependency entries belonging to packages in the install_requires list. The test shows this by intentionally installing a version of Werkzeug that is too old for the version of Flask. Attemp…
View conditional_dependency.py
# -*- coding: utf-8 -*-
### Test by running: pip install -e .[subs]
import sys
from setuptools import setup
major, minor, micro = sys.version_info[:3]
install_requires26 = [
You can’t perform that action at this time.