Skip to content

Instantly share code, notes, and snippets.

View paulcsiki's full-sized avatar

Alexandru Paul Csiki paulcsiki

View GitHub Profile
@paulcsiki
paulcsiki / test.html
Created November 14, 2019 21:05
Hello World Html
<html>
<head>
<style>
h1 {
font-family: Calibri;
}
</style>
</head>
<body>
<h1>Hello World!</h1>
@paulcsiki
paulcsiki / test.md
Created November 14, 2019 21:04
Hello World Markdown

Hello World

This is content converted from Markdown!

Here's a JSON sample:

{
  "foo": "bar"
}
@paulcsiki
paulcsiki / IdentityServer.csproj
Created December 9, 2018 19:57
IdentityServer csproj file for SO question 53696116
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<IsPackable>false</IsPackable>
<SpaRoot>ClientApp\</SpaRoot>
<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
PSObject totalSize = o.Properties["TotalItemSize"].Value as PSObject;
if (totalSize == null) continue;
foreach (PSMethodInfo method in totalSize.Methods)
{
Console.WriteLine(method.Name);
}
@paulcsiki
paulcsiki / gist:10388526
Last active August 29, 2015 13:58
Broken List View
<Grid x:Name="detailsGrid" Margin="120,0,10,10" Grid.Row="1">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden">
<tools:customListView ItemsSource="{Binding Items, ElementName=pageRoot}" SelectionMode="None" IsItemClickEnabled="True" Margin="5,5,0,5" HorizontalAlignment="Left" VerticalAlignment="Top" ItemClick="list_ItemClick" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Height" Value="Auto" />
<Setter Property="Width" Value="Auto" />
<Setter Property="MinWidth" Value="270"/>
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Stretch" />
status)
found="false"
for file in "$crondir/*"; do
echo $file
name="${file%%_*}"
echo $name
time="${file#*_}"
echo $time
hour="`echo $t | awk -F '_' '{ print $1; }'`"
min="`echo $t | awk -F '_' '{ print $2; }'`"
private static void ActionWithTimeout(Action action, int timeout = TIMEOUT)
{
IAsyncResult async = action.BeginInvoke(null, null);
if (!async.AsyncWaitHandle.WaitOne(timeout))
throw new TimeoutException("Action timed out");
}
private static T FuncWithTimeout<T>(Func<T> func, int timeout = TIMEOUT)
{
IAsyncResult async = func.BeginInvoke(null, null);
define('HEADER_NAME','HTTP_INCAP_CLIENT_IP');
try {
//stop process if there is no header
if (empty($_SERVER[HEADER_NAME])) throw new Exception('No header defined', 1);
//validate header value
if (function_exists('filter_var')) {
$ip = filter_var($_SERVER[HEADER_NAME], FILTER_VALIDATE_IP);
@paulcsiki
paulcsiki / VisitorsController
Last active August 29, 2015 13:56
learn-rails issue
class VisitorsController < ApplicationController
def new
logger.debug 'DEBUG: entering new method'
@owner = Owner.new
logger.debug 'DEBUG: Owner name is ' + @owner.name
render 'visitors/new'
end
end