Skip to content

Instantly share code, notes, and snippets.

View gcpantazis's full-sized avatar

George Pantazis gcpantazis

View GitHub Profile
import gql from "graphql-tag";
import jwt from "jsonwebtoken";
import getConfig from "next/config";
import qs from "qs";
import React from "react";
import { withApollo, WithApolloClient } from "react-apollo";
import FullPageLoader from "../components/fullPageLoader";
import { currentUser } from "../__generated__/currentUser";
import { userSignUp } from "../__generated__/userSignUp";
Verifying that "gcpantazis.id" is my Blockstack ID. https://onename.com/gcpantazis
Verifying that "gcpantazis.id" is my Blockstack ID. https://onename.com/gcpantazis
@gcpantazis
gcpantazis / gist:03cf5fdd87cf710210ca
Created April 3, 2015 00:17
Getting sum halstead effort from jscomplexity.org
var labels = document.querySelectorAll('.label');
var matchedLabels = [];
for (var i = 0; i < labels.length; i++) {
if (labels[i].innerText.match('Halstead effort')) {
matchedLabels.push(labels[i]);
}
}
matchedLabels.reduce(function(memo, item) {
var value = item.parentNode.querySelector('.value').innerText * 1;
@gcpantazis
gcpantazis / gulpexample.js
Last active August 29, 2015 14:06
Gulp Notes
'use strict';
// If you're unfamiliar with streams a lot of Gulp will seem super confusing.
// Streams are really critical to Node, and increasingly to the front-end.
// An excellent read: https://github.com/substack/stream-handbook
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
@gcpantazis
gcpantazis / gulpfile.js
Created September 8, 2014 23:32
Gulp setup for browserify with transforms, plugins, minification, and sourcemaps.
var browserify = require('browserify');
var source = require('vinyl-source-stream');
gulp.task('scripts', function() {
var bundler = browserify({
entries: ['./app/scripts/app.js'],
debug: true,
transform: ['reactify', 'debowerify']
});
@gcpantazis
gcpantazis / gulpfile.js
Created September 8, 2014 18:48
Gulp connect with gzip
// Connect
gulp.task('connect', $.connect.server({
root: ['dist'],
port: 9000,
livereload: true,
middleware: function() {
return [
require('connect-gzip').gzip()
];
}
@gcpantazis
gcpantazis / example.js
Created September 3, 2014 20:44
Component / plugin definition pattern
(function() {
var MyModule = function() {
// ...
}
// Browserify / CommonJS
if (typeof module === "object" && typeof module.exports === "object") {
module.exports = MyModule;
@gcpantazis
gcpantazis / deploy.sh
Created June 12, 2014 21:57
Drone setup for deploying every branch to Dokku
#!/bin/bash
if [ $DRONE_BRANCH ]; then
git fetch --unshallow
git remote remove dokku
git remote add dokku dokku@foo.dokkuhost.com:project-bar-$DRONE_BRANCH
git push dokku $DRONE_BRANCH:master
fi
@gcpantazis
gcpantazis / gist:e35a1ac0116ffa045790
Created June 1, 2014 17:55
Hubot watch for JIRA worklogs.
// Description:
// Watch methods for JIRA worklogs
//
// Commands:
// Hubot Set JIRA Worklogs Watch <query> - Have Hubot watch this JQL search for worklog changes.
// Hubot List JIRA Worklog Watches - Displays all the watches Hubot is managing for this channel.
// Hubot Clear JIRA Worklog Watches - Destroy all watches Hubot is managing for this channel.
/*jshint camelcase: false */