Skip to content

Instantly share code, notes, and snippets.

View santoshtechwiz's full-sized avatar

santosh kumar singh santoshtechwiz

View GitHub Profile
namespace Alphabet
{
public class AlphabetTest
{
public static readonly string Alphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
public static readonly int Base = Alphabet.Length;
public static string Encode(int i)
{
if (i == 0) return Alphabet[0].ToString();
@santoshtechwiz
santoshtechwiz / gist:1f9806ac3a45c0a4c953342aa33bfba5
Created August 2, 2016 07:59 — forked from nathanjohnson320/gist:7283784
Use the Google Places API with node.js
exports.randeats = function(req, res){
var key = req.query.key;
var location = encodeURIComponent(req.query.location);
var radius = 16000;
var sensor = false;
var types = "restaurant";
var keyword = "fast";
var https = require('https');
var url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?" + "key=" + key + "&location=" + location + "&radius=" + radius + "&sensor=" + sensor + "&types=" + types + "&keyword=" + keyword;
@santoshtechwiz
santoshtechwiz / devops_training.txt
Created June 29, 2016 15:06 — forked from ssmythe/devops_training.txt
Training materials for DevOps
======
Videos
======
DevOps
What is DevOps? by Rackspace - Really great introduction to DevOps
https://www.youtube.com/watch?v=_I94-tJlovg
Sanjeev Sharma series on DevOps (great repetition to really get the DevOps concept)
@santoshtechwiz
santoshtechwiz / html5-video-streamer.js
Created June 17, 2016 05:49 — forked from paolorossi/html5-video-streamer.js
Node.js HTML5 video streamer
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
@santoshtechwiz
santoshtechwiz / e-commerce.md
Created May 23, 2016 07:22 — forked from hjr3/e-commerce.md
Examples of RESTful API calls for E-commerce platforms

Examples of RESTful API calls for E-commerce platforms

These examples are type 3 RESTful API requests and responses. The JSON-HAL specification is used to implement HATEOAS.

Some of the examples are based on my work as architect of the RESTful API at http://www.hautelook.com. All proprietary information has been removed.

Relevant links

@santoshtechwiz
santoshtechwiz / PowerShell_ODAC.ps1
Created May 11, 2016 10:41 — forked from mnzk/PowerShell_ODAC.ps1
Example Of PowerShell (V3) & Oracle Data Access Components & ADO.net DbProviderFactory
#
# PowerShell (v3.0) + ODAC (and ADO.net)
#
function Load-DbProviderFactory([ScriptBlock[]]$loaders){
$fa = $loaders | foreach {
try{
(& $_)| ? {$_ -is [System.Data.Common.DbProviderFactory]}
}catch{}
} | Select -First 1
@santoshtechwiz
santoshtechwiz / Expr.g4
Created February 8, 2016 12:18 — forked from mattmcd/Expr.g4
ANTLR4 simple expression grammar. Note that left recursion is now allowed and operator precedence is just order of definition.
grammar Expr;
// Need to call recursive rule expr from non-recursive rule
r : expr+ ;
// ANTLR4 : Left recursion!
// Operator precedence matches order of definition
expr : '-' expr // Unary minus
| expr ('*' | '/' ) expr
| expr ('+' | '-' ) expr
@santoshtechwiz
santoshtechwiz / AntiForgeryTokenValidator.asp
Created February 5, 2016 06:56 — forked from lorddev/AntiForgeryTokenValidator.asp
Classic ASP version of ASP.NET MVC AntiForgeryToken validator
<%
' Use with a very short session (basically the page lifecycle, GET then POST)
Class AntiForgeryValidator
Private m_securityToken
Sub SetCookie()
m_securityToken = CreateWindowsGuid()
Response.Cookies("RequestVerificationToken") = m_securityToken
@santoshtechwiz
santoshtechwiz / stripStringHTML.asp
Created January 27, 2016 17:53 — forked from gwobcke/stripStringHTML.asp
Classic ASP Strip HTML Function
<%
FUNCTION stripHTML(strHTML)
Dim objRegExp, strOutput, tempStr
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<(.|n)+?>"
'Replace all HTML tag matches with the empty string
strOutput = objRegExp.Replace(strHTML, "")
'Replace all < and > with &lt; and &gt;