Skip to content

Instantly share code, notes, and snippets.

View kyle-seongwoo-jun's full-sized avatar

Kyle Seongwoo Jun kyle-seongwoo-jun

View GitHub Profile
@kyle-seongwoo-jun
kyle-seongwoo-jun / App.xaml
Last active December 23, 2017 05:31
How to apply a theme in Xamarin.Forms
<?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>
@kyle-seongwoo-jun
kyle-seongwoo-jun / WatchPage.xaml
Created May 5, 2018 11:43
Xamarin.Forms Watch Example
<?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-seongwoo-jun
kyle-seongwoo-jun / Stars.cs
Created May 30, 2018 12:59
Print asterisks (C# 별 찍기)
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-seongwoo-jun
kyle-seongwoo-jun / ClassLibary1.csproj
Created August 7, 2018 06:32
.NET Framework new csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net46</TargetFramework>
</PropertyGroup>
</Project>
#!/bin/bash
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-c|--clean)
CLEAN=1
;;
-r|--restore)
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());
}
@kyle-seongwoo-jun
kyle-seongwoo-jun / Linq.cs
Created December 28, 2018 08:44
C# Linq ToList()
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);
inotifywait --monitor --timefmt '%F %T' --format '%T %w %e %f' $1 -e create -e delete
inotifywait --monitor --timefmt '%F %T' --format '%T %w %e %f' $1 -e create -e delete
test -e /file/path ; [[ $? = 0 ]] && echo True || echo False