Skip to content

Instantly share code, notes, and snippets.

View yazz's full-sized avatar

Zubair Quraishi yazz

View GitHub Profile
@mdnmdn
mdnmdn / ConvertTo-JSON.ps1
Last active December 12, 2024 00:59
ConvertTo-JSON for Powershell 2.0
function Escape-JSONString($str){
if ($str -eq $null) {return ""}
$str = $str.ToString().Replace('"','\"').Replace('\','\\').Replace("`n",'\n').Replace("`r",'\r').Replace("`t",'\t')
return $str;
}
function ConvertTo-JSON($maxDepth = 4,$forceArray = $false) {
begin {
$data = @()
}
@19WAS85
19WAS85 / powershell-web-server.ps1
Last active January 6, 2026 17:35
A simple web server built with powershell.
# This is a super **SIMPLE** example of how to create a very basic powershell webserver
# 2019-05-18 UPDATE — Created by me and and evalued by @jakobii and the comunity.
# Http Server
$http = [System.Net.HttpListener]::new()
# Hostname and port to listen on
$http.Prefixes.Add("http://localhost:8080/")
# Start the Http Server
@pewerner
pewerner / MSAcess.js
Created December 14, 2012 12:08
Query MS-Access Data-base from JS.
function AddRecord() {
//var adoConn = new ActiveXObject("ADODB.Connection");
var adoConn = new ActiveX("ADODB.Connection");
//var adoRS = new ActiveXObject("ADODB.Recordset");
var adoRS = new ActiveX("ADODB.Recordset");
adoConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='/\dbName.mdb'");
adoRS.Open("Select * From tblName", adoConn, 1, 3);
adoRS.AddNew;
@domenic
domenic / promises.md
Last active March 27, 2026 06:34
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
function hello(name){
console.log("Hello " + name);
}
hello('node.js');
@mherkender
mherkender / gist:3026572
Created July 1, 2012 02:43
Why ansible sucks
max@darmani% ansible-playbook -k -i ansible.hosts nabooru.ansible.yml
SSH password:
PLAY [nabooru] ****************************
SETUP PHASE ****************************
ok: [192.168.1.133]