Skip to content

Instantly share code, notes, and snippets.

View nekoslack's full-sized avatar
💭
I may be slow to respond.

김성주 nekoslack

💭
I may be slow to respond.
View GitHub Profile
@nekoslack
nekoslack / DateTimeToSns.cs
Created August 6, 2020 05:25
[C#] DateTime to SNS time
/*
DateTime now = DateTime.Now.AddHours(-10);
Console.WriteLine("now=" + now.ToSnsTime());
*/
using System;
namespace DateTimeToSns_sample
{
public static class Lib
{
@nekoslack
nekoslack / TaskYield.cs
Created August 6, 2020 02:16
[C#] Task.Yield()
using System;
using System.Threading.Tasks;
namespace TaskYieldSample
{
class Program
{
static void Main(string[] args)
{
var list = new int[] { 1, 2, 3, 4, 5 };
@nekoslack
nekoslack / NanoSecSample.cs
Created August 5, 2020 04:27
[C#} To Milliseconds Extension Method
using System;
namespace NanoSecSample
{
class Program
{
static void Main(string[] args)
{
long sec = 45;
int nano = 760000000;
class Program
{
static void Main(string[] args)
{
foreach(int i in Power(2, 8))
{
Console.Write("{0} ", i);
}
}
@nekoslack
nekoslack / YieldSample.cs
Created August 4, 2020 08:42
[C#] Yield
class Program
{
static void Main(string[] args)
{
var x = new MyClass();
x.Go(3, 1000);
}
}
public class MyClass
@nekoslack
nekoslack / GetDynamic.cs
Last active August 4, 2020 08:38
[C#] MySql GetDynamic()
public static dynamic GetDynamic(string sql, string connectionString)
{
dynamic x;
using (SqlConnection cn = new SqlConnection(connectionString))
{
cn.Open();
using (SqlCommand cmd = new SqlCommand(sql, cn))
{
using (SqlDataReader reader = cmd.ExecuteReader())
@nekoslack
nekoslack / [JS]fetch-sample.js
Last active August 4, 2020 08:22
javascript fetch sample
fetch('https://mywebsite.com/mydata.json');
fetch('https://mywebsite.com/endpoint/', {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
firstParam: 'yourValue',