Skip to content

Instantly share code, notes, and snippets.

Avatar

Milton Sosa milsosa

View GitHub Profile
@milsosa
milsosa / test.js
Last active Jul 23, 2019
Run Mocha Tests
View test.js
'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 Oct 9, 2015 — forked from kentcdodds/chooser.js
JSHint Options Chooser
View chooser.js
// 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 Aug 27, 2015 — forked from fhellwig/findParentPkgDesc.js
[Node.js] Finds the pathname of the parent module's package descriptor file.
View findParentPkgDesc.js
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.
*/
View Create central repo
git init --bare my-repo.git
git config core.sharedRepository group
chown -R user.group my-repo.git
View gist:8129628

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
View select_last_update.sql
SELECT UPDATE_TIME
FROM information_schema.tables
WHERE TABLE_SCHEMA = 'dbname'
AND TABLE_NAME = 'tabname'
@milsosa
milsosa / List Domain Users WinNT
Created Nov 19, 2013
List all users of an specific domain Windows
View List Domain Users WinNT
'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 Nov 19, 2013
Get list of Active Directory Users
View List AD Users VBScript
' Get OU
'
strOU = "OU=Users,DC=domain,DC=com"
' Create connection to AD
'
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
' Create command
You can’t perform that action at this time.