Skip to content

Instantly share code, notes, and snippets.

@valerysntx
valerysntx / DotNetCLI.install.cmd
Created May 19, 2016 02:18
automate dotnet CLI deployment // DotNetCore.1.0.0.RC2-SDK.Preview1-x64 // DotNetCore.1.0.0.RC2-VS2015Tools.Preview1.exe
@echo off
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
@cinst DotNetCLI
@powershell -NoProfile -ExecutionPolicy None -Command "Invoke-Expression \""((New-Object Net.WebClient).DownloadFile('https://download.microsoft.com/download/4/6/1/46116DFF-29F9-4FF8-94BF-F9BE05BE263B/DotNetCore.1.0.0.RC2-VS2015Tools.Preview1.exe','DotNetCore.1.0.0.RC2-VS2015Tools.Preview1.exe'))\""
@DotNetCore.1.0.0.RC2-VS2015Tools.Preview1.exe
@powershell -NoProfile -ExecutionPolicy None -Command "Invoke-Expression \""((New-Object Net.WebClient).DownloadFile('https://download.microsoft.com/download/4/6/1/46116DFF-29F9-4FF8-94BF-F9BE05BE263B/packages/DotNetCore.1.0.0.RC2-SDK.Preview1-x64.exe','DotNetCore.1.0.0.RC2-SDK.Preview1-x64.exe'))\""
@DotNetCore.1.0.0.RC2-SDK.Preview1-x64.exe
@pause
@valerysntx
valerysntx / os_structs.h
Last active October 15, 2015 23:03
x86 host x64
#ifndef _OS_STRUCTS_H_
#define _OS_STRUCTS_H_
namespace WOW64
{
#pragma pack (1)
typedef struct _LIST_ENTRY64
{
union
{
@vmysla
vmysla / window_onbeforeerror_event.js
Created September 5, 2015 03:54
window.onBeforeError( myJavaScriptFunction ) with safer.js
///////////////////////////////////////////////////////
var safer = require_saferjs();
///////////////////////////////////////////////////////
var myObject = getBuggyCode();
///////////////////////////////////////////////////////
@vmysla
vmysla / jQueryFrameless.js
Last active August 3, 2018 10:45
Frameless JQuery selectors (early draft preview. created for IFRAMEr users)
/*
usage:
1. create a new IFRAME with "widget" class. make sure CORS works.
<iframe class="widget" id="my-frame"> .... <h1>test</h1> ... </iframe>
2. lookup H1 from IFRAME with jQuery. selector should start with ".widget".
$('.widget') // it should return [ <h1> ] - a collection with a single H1 tag inside
3. bind events, etc.
$('.widget').click(function(){ alert('hooray!!'); });
$('.widget#my-frame *').click(function(){ alert('hooray!!'); });
$('.widget H1').click(function(){ alert('hooray!!'); });
@vmysla
vmysla / gist:5316941
Last active December 15, 2015 20:09
// Subject: Complex object with set of properties and inner objectss
// Mission: Describe fluent DSL to define scheme and delegate action execution
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Text.RegularExpressions;
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@dalethedeveloper
dalethedeveloper / gist:1503252
Created December 20, 2011 21:00
Mobile Device Detection via User Agent RegEx

#Mobile Device Detection via User Agent RegEx

Yes, it is nearly 2012 and this exercise has been done to death in every imaginable language. For my own purposes I needed to get the majority of non-desktop devices on to a trimmed down, mobile optimized version of a site. I decided to try and chase down an up-to-date RegEx of the simplest thing that could possibly work.

I arrived at my current solution after analyzing 12 months of traffic over 30+ US based entertainment properties (5.8M+ visitors) from Jan - Dec 2011.

The numbers solidified my thoughts on the irrelevancy of including browsers/OSes such as Nokia, Samsung, Maemo, Symbian, Ipaq, Avant, Zino, Bolt, Iris, etc. The brass tacks of the matter is that you certainly could support these obscure beasts, but are you really going to test your site on them? Heck, could you even find one?! Unless the folks that pay you are die hard Treo users my guess is "No".

Interestingly enough my research shows that /Mobile/ is more efficient than **/iP(

@mindplay-dk
mindplay-dk / gist:1207086
Created September 9, 2011 19:18
CSS for database queries?

Most query-languages for databases are not as elegant or expressive as CSS.

Has anyone attempted to use CSS selectors as the query language for databases?

This idea lends itself naturally to document databases - let's say you have the following document:

<blogpost title="This Week's Crazy Idea">
  <user name="Rasmus" class="author"/>
  <body>

...