Skip to content

Instantly share code, notes, and snippets.

@tkowalczyk
tkowalczyk / To admin only
Created January 16, 2013 11:33
This gist allow using http://wordpress.org/extend/plugins/private-messages-for-wordpress/ plugin for sending private messages only to Administrator from users. Source code of send-page.php of this plugin.
<?php
/**
* Send form page
*/
function rwpm_send()
{
global $wpdb, $current_user;
?>
<div class="wrap">
<h2><?php _e( 'Send Private Message', 'pm4wp' ); ?></h2>
@tkowalczyk
tkowalczyk / All TTS languages installed
Created April 13, 2013 09:35
This method list all of the installed languages which we can use in TTS applications.
private void InstalledLang()
{
using (SpeechSynthesizer synth = new SpeechSynthesizer())
{
// Output information about all of the installed voices.
Console.WriteLine("Installed voices -");
foreach (InstalledVoice voice in synth.GetInstalledVoices())
{
VoiceInfo info = voice.VoiceInfo;
@tkowalczyk
tkowalczyk / GetClosestSkeleton
Created March 25, 2014 19:10
Get closest skeleton from all of the tracked skeletons
private static Skeleton GetClosestSkeleton(Skeleton[] skeletons)
{
return skeletons
.Where(skeleton => skeleton.TrackingState == SkeletonTrackingState.Tracked)
.OrderBy(skeleton => skeleton.Position.Z).FirstOrDefault();
}
@tkowalczyk
tkowalczyk / Stick on one skeleton via ID
Created April 3, 2014 12:52
Stick on one skeleton via ID
int _trackedSkeletonId = 0;
Skeleton _currentSkeleton;
void sensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
{
_currentSkeleton = null;
using (SkeletonFrame frame = e.OpenSkeletonFrame())
{
if (frame == null)
@tkowalczyk
tkowalczyk / manhattan_dist
Last active January 7, 2019 07:46
How to calculate Manhattan Distance in R?
#How to calculate Manhattan Distance in R?
print("How to calculate Manhattan Distance in R?")
fa <- c(5,2,1,4)
fb <- c(5,5,4,2)
fm <- matrix(c(fa,fb), byrow=T, nrow=2)
col_names_vectors <- c("U1", "U2", "U3", "U4")
row_names_vectors <- c("FilmA","FilmB")
@tkowalczyk
tkowalczyk / euclidean_dist
Created March 25, 2015 12:59
#How to calculate Euclidean Distance in R?
#How to calculate Euclidean Distance in R?
print("How to calculate Euclidean Distance in R?")
fa <- c(5,2,1,4)
fb <- c(5,5,4,2)
fm <- matrix(c(fa,fb), byrow=T, nrow=2)
col_names_vectors <- c("U1", "U2", "U3", "U4")
row_names_vectors <- c("FilmA","FilmB")
Digits and (), min 9 max 20
^[0-9()]{9,20}$
Phone number
@"^([+]{1}[0-9]{2})?([ -]{1})?[0-9]{3}([ -]{1})?[0-9]{3}([ -]{1})?[0-9]{3}$"
<svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" class="highcharts-root" style="font-family:'lucida grande', 'lucida sans unicode', arial, helvetica, sans-serif;font-size:12px;" xmlns="http://www.w3.org/2000/svg" width="1200" viewBox="0 0 1200 800" height="800"><desc>Created with Highcharts 5.0.0</desc><defs><clipPath id="highcharts-9"><rect x="0" y="0" width="1145" height="676" fill="none"></rect></clipPath></defs><rect fill="#ffffff" class="highcharts-background" x="0" y="0" width="1200" height="800" rx="0" ry="0"></rect><rect fill="none" class="highcharts-plot-background" x="45" y="49" width="1145" height="676"></rect><g class="highcharts-grid highcharts-xaxis-grid "><path fill="none" class="highcharts-grid-line" d="M 104.5 49 L 104.5 725" opacity="1"></path><path fill="none" class="highcharts-grid-line" d="M 165.5 49 L 165.5 725" opacity="1"></path><path fill="none" class="highcharts-grid-line" d="M 225.5 49 L 225.5 725" opacity="1"></path><path fill="none" class="highcharts-grid-line" d="M 2
function scroll(){ window.scrollTo(0,document.body.scrollHeight); console.log(document.body.scrollHeight); }; setInterval(scroll, 3000);
USE YourDatabase
GO
SELECT db.[name] AS [DatabaseName]
,id.[object_id] AS [ObjectID]
,OBJECT_NAME(id.[object_id], db.[database_id]) AS [ObjectName]
,id.[statement] AS [FullyQualifiedObjectName]
,id.[equality_columns] AS [EqualityColumns]
,id.[inequality_columns] AS [InEqualityColumns]
,id.[included_columns] AS [IncludedColumns]