Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View dangowans's full-sized avatar
😨
Losing sleep over Y10K compliance.

Dan Gowans dangowans

😨
Losing sleep over Y10K compliance.
  • Sault Ste. Marie, Ontario, Canada
  • 03:19 (UTC -04:00)
View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active April 23, 2024 05:25
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@heiswayi
heiswayi / repo-reset.md
Created February 5, 2017 01:32
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@TheBryanMac
TheBryanMac / MapService2Shapefile.py
Last active November 26, 2023 06:04
Export ArcGIS Server Map Service Layer to Shapefile
#Name: Export ArcGIS Server Map Service Layer to Shapefile
#Author: Bryan McIntosh
import urllib2, os, arcpy
# Variables
myUrl = "https://sampleserver6.arcgisonline.com/arcgis/rest/services"
myService = "/Census/MapServer"
myParams = "/3/query?where=1%3D1&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=*&returnGeometry=true&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&returnZ=false&returnM=false&returnDistinctValues=false&returnTrueCurves=false&f=pjson"
# Query ArcGIS Server Map Service
@f4nd4ngo
f4nd4ngo / Canon_report.py
Created March 21, 2015 02:15
Canon Printers Counters Report
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#Get SNMP Value for canon printers for total page count using PySNMP, export to pdf, then email to required user#
#Need to install pysnmp, reportlab and smtplib using pip or easy install#
#Those are the OIDS for counters and serial
#TOTAL: .1.3.6.1.4.1.1602.1.11.1.3.1.4.102
#COLOR: .1.3.6.1.4.1.1602.1.11.1.3.1.4.106
#B/W: .1.3.6.1.4.1.1602.1.11.1.3.1.4.109
#SERIAL: .1.3.6.1.2.1.43.5.1.1.17.1
#TOTAL SOME C2020: .1.3.6.1.4.1.1602.1.11.1.3.1.4.101
@neelsg
neelsg / DecodeXML.vba
Created November 3, 2014 11:53
Functions to decode or encode text for use in an XML file. VBScript / VBA
Public Function DecodeXml(TextToDecode As String) As String
'Take text that has been encoded for XML and change it to normal text
Dim Res As String
Res = Replace(Replace(Replace(Replace(TextToDecode, "&quot;", """"), "&gt;", ">"), "&lt;", "<"), "&amp;", "&")
DecodeXml = Res
End Function
@jpoehls
jpoehls / node-cluster-messaging.js
Created March 29, 2012 01:48
Simple message passing between cluster master and workers in Node.js
var cluster = require('cluster');
if (cluster.isWorker) {
console.log('Worker ' + process.pid + ' has started.');
// Send message to master process.
process.send({msgFromWorker: 'This is from worker ' + process.pid + '.'})
// Receive messages from the master process.