Skip to content

Instantly share code, notes, and snippets.

echo = function(areq) { console.log(areq.response) };
requests = (function() {
var module = {};
var AsyncRequest = XMLHttpRequest;
// takes a dict and returns a string "a=b&c=d"
var toUrlParams = function(dict) {
var res = [];
for(var key in dict) {
@andrijac
andrijac / rename.rb
Last active December 16, 2015 18:59
=begin
Used:
http://stackoverflow.com/questions/1274605/ruby-search-file-text-for-a-pattern-and-replace-it-with-a-given-value
http://stackoverflow.com/questions/4244611/pass-variables-to-ruby-script-via-command-line
Replace WCF https connection to http
=end
file_name = ARGV[0]
public static string GenerateDbCall(IDbCommand command)
{
switch (command.CommandType)
{
case CommandType.Text:
case CommandType.TableDirect:
return command.CommandText;
case CommandType.StoredProcedure:
=begin
Used:
http://stackoverflow.com/questions/1274605/ruby-search-file-text-for-a-pattern-and-replace-it-with-a-given-value
http://stackoverflow.com/questions/4244611/pass-variables-to-ruby-script-via-command-line
Replace WCF https connection to http
=end
file_name = ARGV[0]
@andrijac
andrijac / UnicodeHelper.cs
Created May 8, 2013 06:11
Replace unicode characters (that may pop up in text that is sometimes pasted by user in input field from weird sources) with appropriate ANSI equivalent.
public static class UnicodeHelper
{
public static readonly Dictionary<string, string> CharacterPairs = new Dictionary<string, string>()
{
{"’", "'"}, // UTF-8: E2 80 99
{"‘", "'"}, // UTF-8: E2 80 98
{"‚", ","}, // UTF-8: E2 80 9A
{"‛", "'"},
{"“", "\""}, // UTF-8: E2 80 9C
{"”", "\""}, // UTF-8: E2 80 9D
using System;
using System.Threading;
namespace ConsoleApplication11
{
internal class Program
{
private static void Main(string[] args)
{
for (int i = 0; i < 50; i++)
#TODO: add attribute for PrimaryKey
#TODO: add attribute for GeneratedColumns
#TODO: add attribute for XmlElement
fileName = ARGV[0]
types = Hash.new
types[/bit/] = 'bool'
types[/decimal/] = 'decimal'
types[/varchar\([0-9]\)/] = 'string'
System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
@andrijac
andrijac / install_aspnet.bat
Created May 19, 2013 13:26
Install ASP.NET on IIS
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
::%windir%\Microsoft.NET\Framework\v4.0.21006\aspnet_regiis.exe -i