Skip to content

Instantly share code, notes, and snippets.

@jon-kim
jon-kim / ExtensionMethods_XamlClone.cs
Created June 6, 2017 19:34
Clone WPF User Control
public static class ExtensionMethods
{
public static T XamlClone<T>(this T original) where T : class
{
if (original == null)
return null;
object clone;
using (var stream = new MemoryStream())
{
XamlWriter.Save(original, stream);
@jon-kim
jon-kim / autoCompleteGoogleMapApi.html
Last active December 20, 2021 10:54
Auto Complete Location using Google Map API
<!DOCTYPE html>
<html>
<head>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places"></script>
</head>
<body>
<label for="locationTextField">Location</label>
<input id="locationTextField" type="text" size="50">
<script>
@jon-kim
jon-kim / CreateEmployeeTimetable_Pivot_Dynamic.SQL
Last active May 30, 2020 02:57
Pivot with Dynamic column values
CREATE TABLE #DATA (
name VARCHAR(50),
shift_start DATETIME,
shift_end DATETIME
)
INSERT INTO #DATA VALUES ('Boony Antonchik', '2017-05-30 14:00', '2017-05-30 17:00')
INSERT INTO #DATA VALUES ('Toma Wittier', '2017-05-30 14:00', '2017-05-30 15:00')
INSERT INTO #DATA VALUES ('Genvieve Arends', '2017-05-30 8:00', '2017-05-30 13:00')
INSERT INTO #DATA VALUES ('Ulla Friatt', '2017-05-30 18:00', '2017-05-30 19:00')
INSERT INTO #DATA VALUES ('Giralda Ranfield', '2017-05-30 13:00', '2017-05-30 15:00')
soundcloud different_url
https://api.soundcloud.com/tracks/910291 https://api.different-embed.com/12345
https://api.soundcloud.com/tracks/5678 https://api.different-embed.com/562222278
https://api.soundcloud.com/tracks/12345 https://api.different-embed.com/89999999
@jon-kim
jon-kim / CreateEmployeeTimetable_Pivot.SQL
Last active June 6, 2017 19:39
Create Employee Timetable with PIVOT in SQL Server
CREATE TABLE #DATA (
name VARCHAR(50),
shift_start DATETIME,
shift_end DATETIME
)
INSERT INTO #DATA VALUES ('Boony Antonchik', '2017-05-30 14:00', '2017-05-30 17:00')
INSERT INTO #DATA VALUES ('Toma Wittier', '2017-05-30 14:00', '2017-05-30 15:00')
INSERT INTO #DATA VALUES ('Genvieve Arends', '2017-05-30 8:00', '2017-05-30 13:00')
INSERT INTO #DATA VALUES ('Ulla Friatt', '2017-05-30 18:00', '2017-05-30 19:00')
@jon-kim
jon-kim / autoCompleteLngLatGoogleMapApi.html
Last active June 6, 2017 19:38
Auto Complete Location and Get Longitude and Latitude using Google Map API
<!DOCTYPE html>
<html>
<head>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places"></script>
</head>
<body>
<label for="locationTextField">Location</label>
<input id="locationTextField" type="text" size="50">
<div id="output" />
<script>