Skip to content

Instantly share code, notes, and snippets.

View Josh-Miller's full-sized avatar

Josh Miller Josh-Miller

  • Finn Ridge Capital
View GitHub Profile
@Josh-Miller
Josh-Miller / keybase.md
Created October 7, 2017 05:10
Keybase.md

Keybase proof

I hereby claim:

  • I am josh-miller on github.
  • I am joshmili (https://keybase.io/joshmili) on keybase.
  • I have a public key ASCNmoG6Svfm6lI2RCwxd65Ur4He6aY3vJOtzMQvzKCqOQo

To claim this, I am signing this object:

@Josh-Miller
Josh-Miller / node-express-cors-middleware.js
Created July 22, 2016 07:18 — forked from cuppster/node-express-cors-middleware.js
express.js middleware to support CORS pre-flight requests
app.use(express.methodOverride());
// ## CORS middleware
//
// see: http://stackoverflow.com/questions/7067966/how-to-allow-cors-in-express-nodejs
var allowCrossDomain = function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization');
build:
docker build -t node-portal .
stopdev:
- docker kill node-portal
- docker rm node-portal
startdev:
docker run \
-v $(shell pwd)/app/src:/var/node/app/src \
@Josh-Miller
Josh-Miller / stateManager.js
Created December 18, 2015 18:24
A state manager for Phaser v2 html5 game platform
'use strict';
export const stateManager = {
state: [],
states: {},
currentState: function() {
return this.state;
},
@Josh-Miller
Josh-Miller / view_mode_enabled_in_code.php
Created September 25, 2015 17:16
Sets a view mode to be enabled in code.
<?php
/**
* Run this in hook_update, enable, or install
**/
$settings = field_bundle_settings('node', 'article');
$settings['view_modes']['view_mode_name']['custom_settings'] = TRUE;
field_bundle_settings('node', 'article', $settings);
@Josh-Miller
Josh-Miller / install.txt
Last active August 29, 2015 14:27 — forked from cburgmer/install.txt
Take a screenshot with selenium from node
npm install selenium-webdriver
npm install selenium-server-standalone-jar
npm install phantomjs
@Josh-Miller
Josh-Miller / pager.inc
Created June 1, 2015 18:14
Overwrite pager names in Drupal
/**
* Implements hook_preprocess_pager().
*/
function THEME_preprocess_pager(&$vars, $hook) {
$vars['tags'][0] = 'first';
$vars['tags'][1] = 'previous';
$vars['tags'][3] = 'next';
$vars['tags'][4] = 'last';
}
<?php if (isset($rows)): ?>
<?php foreach($rows as $row): ?>
<div class="field-row">
<div class="field-item">
<?php print render($row['field_some_field']); ?>
</div>
<div class="field-item">
<?php print render($row['field_someother_field']); ?>
</div>
</div>
@Josh-Miller
Josh-Miller / blob_variable_setting.php
Created May 13, 2015 15:16
How to set a blob variable setting in Drupal
$knowledge_lab_settings = variable_get('theme_knowledge_lab_settings', array());
$knowledge_lab_settings['default_logo'] = 0;
variable_set('theme_knowledge_lab_settings', $knowledge_lab_settings);
@Josh-Miller
Josh-Miller / affix.js
Created April 22, 2015 16:30
Bootstrap Affix plugin that is back ported to work with jQuery 1.4 (for Drupal CMS)
/* ========================================================================
* Bootstrap: affix.js v3.3.4
* http://getbootstrap.com/javascript/#affix
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {