Skip to content

Instantly share code, notes, and snippets.

View Maxhodges's full-sized avatar
🐰
Rabbithole

Max Hodges Maxhodges

🐰
Rabbithole
View GitHub Profile
@Maxhodges
Maxhodges / OMG model
Created February 12, 2021 17:16
est package volume from weight (g)
/**
* Predictor for volume from model/6026afde2fb31c391800250b
* Predictive model by BigML - Machine Learning Made Easy
*/
function predictVolume(weightG) {
if (weightG == null) {
return 6715.89082;
}
else if (weightG > 869) {
-- This template returns the number of charges and amounts for each card type, by currency
-- Note: if you have currencies that do not have cents (e.g. JPY), you should not divide by 100.0
select
card_country,
count(id) as charge_count,
sum(amount)/100.0 as total_amount
from charges
where captured and card_country in ('AT', 'BE', 'HR', 'BG', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE',
'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'GB')
group by 1
db.adhocPackages.find().forEach( function(doc) {
doc.japanPostCountryRegionCode= new NumberInt(doc.japanPostCountryRegionCode);
db.adhocPackages.save(obj);
} )
@Maxhodges
Maxhodges / mongodb index crawler
Created May 7, 2018 05:43
find 'safe' collection indexes
use whiterabbit
db.indexes.find();
db.shippingOrders.getIndexes();
db.getCollectionNames().forEach(function(collection) {
if (db[collection]) {
indexes = db[collection].getIndexes();
var filterIndexes = Object.keys(indexes).filter(function(i) {
@Maxhodges
Maxhodges / Layout.vue
Created December 4, 2017 10:00
dynamic items for navigation drawer
<template>
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons' rel="stylesheet"/>
<link href="https://unpkg.com/vuetify/dist/vuetify.min.css" rel="stylesheet"/>
</head>
<body>
<div id="app">
<v-app id="inspire" dark>
const _ = require(`lodash`);
const Promise = require(`bluebird`);
const path = require(`path`);
const slash = require(`slash`);
// Implement the Gatsby API “createPages”. This is
// called after the Gatsby bootstrap is finished so you have
// access to any information necessary to programatically
// create pages.
exports.createPages = ({ graphql, boundActionCreators }) => {
max
[20:28]
var _ = require(‘lodash’); var ids = []; _.times(5000, () => ids.push(Random.id())); copy(ids.join(‘\n’));
VM2093:1 Uncaught ReferenceError: require is not defined
at <anonymous>:1:9
[20:28]
maybe it will run in jsfiddle?
private void ListenerCallback(IAsyncResult result)
{
try
{
var context = listener.EndGetContext(result);
// Thread.Sleep(1000);
Console.WriteLine("{0}: {1}", DateTime.Now, context.Request.Headers);
public void PrintPDF(Stream PDFtoPrint, string jobName)
{
//Create PdfViewer object
PdfViewer viewer = new PdfViewer();
logger.Info("PrintPDF");
//Open input PDF file
viewer.BindPdf(PDFtoPrint);
// string pdffilename = @"c:\temp\blue.pdf";
感児(1かん2じ)
印象(1いん2しょう)
すし(1す2し)
寿司(1す2し)