Skip to content

Instantly share code, notes, and snippets.

👨‍💻
Focusing

Kyle John kyle-john

👨‍💻
Focusing
Block or report user

Report or block kyle-john

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View folderwatcher.sh
inotifywait --monitor --timefmt '%F %T' --format '%T %w %e %f' $1 -e create -e delete
View folderwatcher.sh
inotifywait --monitor --timefmt '%F %T' --format '%T %w %e %f' $1 -e create -e delete
@kyle-john
kyle-john / Linq.cs
Created Dec 28, 2018
C# Linq ToList()
View Linq.cs
var originArray = Enumerable.Range(1, 10).ToList();
IEnumerable<int> subArray = originArray.Where(x => x != 0); // works with originArray
IEnumerable<int> subArray = originArray.Where(x => x != 0).ToList(); // creates new array
while (subArray.Count() > 0)
{
var item = subArray.First();
originArray.Remove(item);
Console.WriteLine(item);
View Utils.cs
namespace WinFormsUtil
{
public static class ListViewUtils
{
public static void SetSource<T>(this ListView.ListViewItemCollection items, IEnumerable<T> source, Func<T, ListViewItem> func)
{
items.Clear();
items.AddRange(source.Select(func).ToArray());
}
View opts.sh
#!/bin/bash
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-c|--clean)
CLEAN=1
;;
-r|--restore)
@kyle-john
kyle-john / ClassLibary1.csproj
Created Aug 7, 2018
.NET Framework new csproj
View ClassLibary1.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net46</TargetFramework>
</PropertyGroup>
</Project>
@kyle-john
kyle-john / Stars.cs
Created May 30, 2018
Print asterisks (C# 별 찍기)
View Stars.cs
string Stars(int lineCount)
{
string num = "";
return string.Join('\n', (from item in Enumerable.Range(1, lineCount) select num += "*").ToArray());
}
Console.WriteLine(Stars(10));
@kyle-john
kyle-john / WatchPage.xaml
Created May 5, 2018
Xamarin.Forms Watch Example
View WatchPage.xaml
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Watch"
x:Class="Watch.WatchPage">
<Grid>
<Grid x:Name="hourBox"
HorizontalOptions="Center"
VerticalOptions="Fill">
<Grid.RowDefinitions>
@kyle-john
kyle-john / App.xaml
Last active Dec 23, 2017
How to apply a theme in Xamarin.Forms
View App.xaml
<?xml version="1.0" encoding="utf-8" ?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ThemeDemo.App">
<Application.Resources>
<ResourceDictionary>
<Color x:Key="BackgroundColorDark">#121212</Color>
<Color x:Key="BackgroundColorLight">#ffffff</Color>
<Color x:Key="BackgroundColorBrown">#292220</Color>
You can’t perform that action at this time.