Skip to content

Instantly share code, notes, and snippets.

MapEditMode _mapEditMode = MapEditMode.normal;
private void wpfMap1_MapClick(object sender, ThinkGeo.MapSuite.WpfDesktopEdition.MapClickWpfMapEventArgs e) {
if (_mapEditMode == MapEditMode.add_text) {
_mapEditMode = MapEditMode.adding_text;
wpfMap1.Cursor = Cursors.Arrow;
var canvas = new Canvas();
TextEditor editor = null;
@mwinckler
mwinckler / find_tables_with_rows.sql
Created August 18, 2011 16:23
sqlserver: find table names having more than X rows
/*
Find all tables having more than X rows
-----
Prints table name if the table has more than @minRows rows
Replace #{DBNAME} with database name
Edit (or remove) where clause as desired
*/
select 'declare @name varchar(50), @ct int, @minRows int;
set @minRows = 0;'
@mwinckler
mwinckler / list_columns_from_table.sql
Created March 27, 2012 23:31
SQL Server: List column names from table
declare @s varchar(4000);
set @s = null;
select @s = coalesce(@s + ', ' + column_name, column_name)
from information_schema.COLUMNS
where TABLE_NAME = 'sb_tmpSamplePAList';
select @s;
@mwinckler
mwinckler / sc2planner_printhack.js
Created April 26, 2012 20:50
SC2Planner.com format-for-print bookmarklet
(function() {
var boName = prompt('What do you want to name this build order?');
var supply = 6;
var orders = $('<ol></ol>').css({'list-style-type':'none'});
// For the duration this window is displayed, suspend the
// document events trapping selection/mousedown/etc so that
// the user can select/copy/paste the build order. See the
// click handler on the close buttons for event restoration.
var docEvents = jQuery.extend(true, {}, $(document).data('events'));
@mwinckler
mwinckler / README.markdown
Created May 2, 2012 15:14
SQL Server: Generate a Data Dictionary

up_generate_data_dictionary

To use this sproc, after creating it in the database you want to document, execute it in SQL Management Studio and view the "Messages" tab. Copy the contents of the "message" tab out into a text file, save it with a .html extension, and open it in a web browser.

@mwinckler
mwinckler / gist:3417914
Created August 21, 2012 17:59
Regex to generate C# INotifyPropertyChanged-compliant properties

Start with a list that looks like this:

public string MyProperty
public int MySecondProperty
public bool HoweverManyPropertiesYouWant

...then run a Find/Replace using regular expressions as follows:

Find:

@mwinckler
mwinckler / gist:3623058
Created September 4, 2012 16:24
Base64-encode a file's contents
# Prompts for filename then base64-encodes the given file's contents and
# writes a new .base64 file in the same directory with the encoded contents.
# Handy for encoding stuff via irb.
require 'base64'
Proc.new {|filename| IO.write(filename.chomp(File.extname(filename)) + '.base64', Base64.strict_encode64(IO.binread(filename))) }.call([(print 'Filename: '), gets.rstrip][1])
@mwinckler
mwinckler / find_tables_by_column.sql
Created October 25, 2012 22:58
Find all tables in SQL server having column name
-- From http://stackoverflow.com/a/4849704/81554
SELECT c.name AS ColName, t.name AS TableName
FROM sys.columns c
JOIN sys.tables t ON c.object_id = t.object_id
WHERE c.name LIKE '%MyName%'
SELECT COLUMN_NAME, TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME LIKE '%MyName%'
@mwinckler
mwinckler / plex_season_rename_bookmarklet.js
Last active April 27, 2020 16:12
Bookmarklet to rename TV show seasons in Plex
javascript:(function() { var input = document.createElement('input'); input.setAttribute('type', 'hidden'); input.setAttribute('name', 'title'); input.setAttribute('value', prompt('New title:')); document.getElementById('lockable-summary').parentNode.appendChild(input); })();
@mwinckler
mwinckler / nginx_proxy_location_directive.conf
Created December 19, 2015 21:58
Nginx: proxy all requests to new server
location / {
proxy_pass http://<ip-address-of-new-server>;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_buffering off;
}