Skip to content

Instantly share code, notes, and snippets.

@milsosa
milsosa / test.js
Last active July 21, 2021 21:20
Run Mocha Tests
'use strict';
// 1. Create the file: {projectRoot}/test.js
// 2. Install dependencies: npm i glob why-is-node-running
// 3. Run the tests: node --expose-internals test.js
const whyIsNodeRunning = require('why-is-node-running');
const glob = require('glob');
const Mocha = require('mocha');
@milsosa
milsosa / chooser.js
Last active October 9, 2015 20:03 — forked from kentcdodds/chooser.js
JSHint Options Chooser
// Just paste this into the console on http://www.jshint.com/docs/options/
(function() {
var i, row, link, span, extraCol, checkbox, value;
var rows = document.querySelectorAll('table.options tr');
var links = document.querySelectorAll('table.options a');
// add checkboxes
for (var i = 0; i < rows.length; i++) {
row = rows[i];
@milsosa
milsosa / findParentPkgDesc.js
Last active August 27, 2015 21:54
[Node.js] Finds the pathname of the parent module's package descriptor file.
var fs = require('fs');
var path = require('path');
/**
* Finds the pathname of the parent module's package descriptor file. If the
* directory is undefined (the default case), then it is set to the directory
* name of the parent module's filename. If no package.json file is found, then
* the parent directories are recursively searched until the file is found or
* the root directory is reached. Returns the pathname if found or null if not.
*/
git init --bare my-repo.git
git config core.sharedRepository group
chown -R user.group my-repo.git

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
SELECT UPDATE_TIME
FROM information_schema.tables
WHERE TABLE_SCHEMA = 'dbname'
AND TABLE_NAME = 'tabname'
@milsosa
milsosa / List Domain Users WinNT
Created November 19, 2013 17:31
List all users of an specific domain Windows
'ListUsers.vbs
On Error Resume Next
Set objDomain = GetObject("WinNT://YourDomain")
WScript.echo "Domain : " + objDomain.name
For each objDomainItem in objDomain
if objDomainItem.Class = "User" then
WScript.echo objDomainItem.Name + " : Full Name: " + objDomainItem.FullName
@milsosa
milsosa / List AD Users VBScript
Created November 19, 2013 17:28
Get list of Active Directory Users
' Get OU
'
strOU = "OU=Users,DC=domain,DC=com"
' Create connection to AD
'
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
' Create command