Skip to content

Instantly share code, notes, and snippets.

View slattery's full-sized avatar

Mike Slattery slattery

View GitHub Profile
@slattery
slattery / drupal.md
Last active October 11, 2022 14:44 — forked from megclaypool/drupal.md
[I forgot my Password: Command Line Tools to the Rescue!] Note that these commands can also come in handy if your front-end is so messed up that you can't access the login screen...

Drush one-time login link for Drupal accounts

Holy crap, I never knew about this before, but this is awesome.

The command is drush uli

It's got options,

  • name for the username
  • uri to specify the url of the site (our weird setup requires us to specify the url of our site)
@slattery
slattery / mymodule--feature.js.js
Created August 12, 2022 19:11 — forked from edutrul/mymodule--feature.js.js
How to add javascript by using drupal 8 libraries using Drupalsettings(to pass php(backend) variables to js(frontend). This can be applied to files: ".theme", ".module"m "field formatter class", "views field handler", etc files. Also uses javascript drupal behaviours (great practice in D8) Plus contains "once" which only enables to execute one t…
// File js/mymodule--feature.js
(function ($) {
Drupal.behaviors.mymodule__feature = {
attach: function (context, drupalSettings) {
// Use once to avoid tu call multiple times a js.
$(document).once('feature').on('click', '.button--feature', (function (event) {
event.preventDefault();
if (typeof drupalSettings.mymodule.feature.id != 'undefined') {
console.log('Your great logic goes here and will NOT be called multiple times');
}
@slattery
slattery / query-aws-logs-insights.bash
Created February 6, 2022 18:12 — forked from dsmrt/query-aws-logs-insights.bash
Using AWS CLI to query CloudWatch Logs with Insights. Looking -30 mins to now.
aws logs start-query \
--profile clientProfile \
--log-group-name MY-LOG_GROUP \
--start-time `date -v-30M "+%s"` \
--end-time `date "+%s"` \
--query-string 'fields @message | filter @message like /my query/'
@slattery
slattery / embedded-file-viewer.md
Created February 7, 2020 14:37 — forked from tzmartin/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@slattery
slattery / .block
Last active April 16, 2019 13:32 — forked from HarryStevens/.block
World Tour
license: gpl-3.0
@slattery
slattery / .block
Created April 5, 2019 22:51 — forked from dianaow/.block
Vega-lite: Stacked bar chart of US Army Infantry Casualties of Vietnam War
license: mit
@slattery
slattery / .block
Last active March 22, 2019 14:51 — forked from XavierGimenez/.block
Grouping nodes in a Force-Directed Graph (many flavored)
license: gpl-3.0
height: 600
@slattery
slattery / .block
Created March 14, 2019 20:34 — forked from nstets/.block
ischool-geo-viz-template
license: mit
@slattery
slattery / README.md
Created March 14, 2019 20:31 — forked from danswick/README.md
CSV on a GL map!

Using @tmcw's csv2geojson to add points from a CSV to a Mapbox GL JS map.

@slattery
slattery / 311-requests.csv
Created February 21, 2019 21:45 — forked from veltman/311-requests.csv
Recalculating hexagon bins on the fly
We can't make this file beautiful and searchable because it's too large.
lat,lng
40.640631015372094,-74.09561928538822
40.76611239235329,-73.9657263554248
40.81357085356432,-73.84674955146295
40.66491294048548,-73.95715625819152
40.86178909285141,-73.92702666410356
40.78354298068182,-73.97122051245215
40.720536662860404,-73.73210914651048
40.7190977072584,-73.8155960317422
40.859180410153655,-73.8936695160749