Skip to content

Instantly share code, notes, and snippets.

@franz-josef-kaiser
franz-josef-kaiser / wp-config.php
Last active April 25, 2024 01:19
My default wp-config.php file for the nightly.dev stack. Not beautiful, but it got everything.
<?php
# SHORTS
# DIRECTORY SEPARATOR
define( 'DS', DIRECTORY_SEPARATOR );
# PATH SEPARATOR
define( 'PS', PATH_SEPARATOR );
# Absolute path to the WordPress directory.
! defined( 'ABSPATH' )
AND define( 'ABSPATH', dirname( __FILE__ ).DS );
@Curookie
Curookie / C# 중급.md
Last active April 25, 2024 01:19
이펙티브 C#

C# 언어 요소

지역변수를 선언할 때는 var를 사용하는 것이 낫다.

긴 자료형에서 타이핑/가독성 이득을 보고, 변수명을 뚜렷하게 네이밍하고 var 사용하는 방식을 채택하는게 좋다.
다만, 내장 숫자 타입(int, float, double 등)을 선언할 때는 명시적으로 타입을 선언하는 편이 낫다.

const 보다는 readonly 가 좋다.

런타임 상수는 컴파일 상수보다 성능이 약간 떨어지지만 유연성이 높고, 어셈블리를 재컴파일을 하지않아도 된다.
static readonly로 사용 시, 인스턴스 별로 다른 값을 갖을 수 있다. 생성자에서 정의할 수 있기 때문이다.
다만, 컴파일할 때 사용되는 상숫값을 정의할 때는 const를 사용한다. 특성의 매개변수, switch/case 문의 레이블, enum 정의 시 사용하는 상수등.

<?php
# SHORTS
# DIRECTORY SEPARATOR
define( 'DS', DIRECTORY_SEPARATOR );
# PATH SEPARATOR
define( 'PS', PATH_SEPARATOR );
# Absolute path to the WordPress directory.
! defined( 'ABSPATH' )
AND define( 'ABSPATH', dirname( __FILE__ ).DS );
@jboner
jboner / latency.txt
Last active April 25, 2024 01:18
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@jarrettmeyer
jarrettmeyer / ObjectToDictionaryHelper.cs
Created January 27, 2011 15:53
C# convert an object to a dictionary of its properties
public static class ObjectToDictionaryHelper
{
public static IDictionary<string, object> ToDictionary(this object source)
{
return source.ToDictionary<object>();
}
public static IDictionary<string, T> ToDictionary<T>(this object source)
{
if (source == null)
@rxaviers
rxaviers / gist:7360908
Last active April 25, 2024 01:12
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@bmaupin
bmaupin / free-database-hosting.md
Last active April 25, 2024 01:10
Free database hosting
@zthxxx
zthxxx / Activate Office 2019 for macOS VoL.md
Last active April 25, 2024 01:09
crack activate Office on mac with license file
@sjrogers
sjrogers / calibre_last_accessed.md
Last active April 25, 2024 01:08
How To Add "Last Accessed" Column In Calibre

How To Add "Last Accessed" Column In Calibre

Calibre does not keep track of the last time you opened a book, but your filesystem does. Or at least, it kinda does. Thankfully you can use Calibre template functions and custom columns to make use of this information.

Step 1: Create Template Function

  1. Go to Preferences -> Advanced -> Template Functions
  2. Select the Function field at the bottom left of the window