Skip to content

Instantly share code, notes, and snippets.

View KennethanCeyer's full-sized avatar
🤣
Making freaking awesome stuff

Sungmin Han KennethanCeyer

🤣
Making freaking awesome stuff
View GitHub Profile
@KennethanCeyer
KennethanCeyer / parsing_og_image.php
Last active September 24, 2015 17:12
Parsing og:image meta data and download image file to your server.
<?php
// 해당 소스는 curl을 사용하기 때문에, 서버에서 PHP Curl extension을 사용할 수 있어야 합니다.
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $LinkView['link_url']);
// $LinkView['link_url']에 원하는 대상 페이지 주소를 넣어주세요.
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec($ch);
curl_close($ch);
@KennethanCeyer
KennethanCeyer / css3-mobile-acceleration.css
Created September 29, 2015 11:49
It makes to be able to accelerate css render speed on device.
* { transform: translateZ(0); -webkit- transform: translateZ(0); }
@KennethanCeyer
KennethanCeyer / hex_to_byte_dword_or_not.cs
Created October 1, 2015 01:11
It uses for the game client packet. If you treat the variable to DWORD or not, it makes you wish.
public void setBnetByte(String strData, bool isVariable = false)
{
String hexData = bnetHelper.Acsii2Hex(strData);
if (isVariable)
{
byte[] bData = bnetHelper.Hex2Byte(hexData);
this.setBnetByte(bData);
}
else {
UInt32 intData = UInt32.Parse(hexData, System.Globalization.NumberStyles.AllowHexSpecifier);
@KennethanCeyer
KennethanCeyer / C-Sharp-Socket-IPAdress-From-DNS.cs
Created October 1, 2015 01:24
C# Socket bind ip from the dns domain name.
IPAddress bnetServerIP = Dns.GetHostAddresses(bnetConInfo["ip"])[0];
IPEndPoint bnetServerEP = new IPEndPoint(bnetServerIP, Int32.Parse(bnetConInfo["port"]));
this.bnetSock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
byte[] receiveBuffer = new byte[255];
try
{
this.bnetSock.ReceiveBufferSize = Int32.MaxValue;
this.bnetSock.ReceiveTimeout = 3000;
this.getHandleMsg(BnetCode.ConnectionWithServer);
@KennethanCeyer
KennethanCeyer / Socket-packet-little-endian-and-big-endian.cs
Created October 1, 2015 01:27
About little endian and big endian when socket programing
private List<byte> bnetData = new List<byte>();
private BnetHelper bnetHelper = BnetHelper.getInstance();
public byte bnetCommand;
public int serverToken = 0;
public int clientToken = 0;
public BnetProtocol()
{
}
@KennethanCeyer
KennethanCeyer / list_view_textwrapping.cs
Created October 3, 2015 11:09
ListView TextWrapping using TextBlock
ListBoxItem lb = new ListBoxItem();
TextBlock tb = new TextBlock();
/* ListView TextWrapping using TextBlock. */
tb.TextWrapping = TextWrapping.Wrap;
tb.Text = data;
lb.Content = tb;
MainChatList.Items.Add(lb);
MainChatList.SelectedIndex = MainChatList.Items.Count - 1;
MainChatList.ScrollIntoView(MainChatList.Items[MainChatList.Items.Count - 1]);
@KennethanCeyer
KennethanCeyer / ListBox_Add_Two_Textblock.cs
Created October 4, 2015 06:33
How to Add more than two TextBlock object in ListBoxItem
ListBoxItem lb = new ListBoxItem();
DockPanel dp = new DockPanel();
TextBlock user = new TextBlock();
user.Text = data.name;
if(data.color != null)
{
user.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#" + data.color));
}
TextBlock tb = new TextBlock();
tb.TextWrapping = TextWrapping.Wrap;
@KennethanCeyer
KennethanCeyer / android_listview_additem.java
Created October 4, 2015 06:48
Android ListView Add Item From Array
ListView mList = (ListView) findViewById(R.id.mainList);
String[] items = new String[] {
"Hello World!",
"Foo Bar",
"404 Not Found",
"Dev Students"
};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, items);
mList.setAdapter(adapter);
@KennethanCeyer
KennethanCeyer / wpf_tabcontrol_selection_changed_problem.cs
Created October 6, 2015 18:05
WPF TabControl Selection Changed : The solution that problem calling those event infinitely.
private void MainTabChanged(object sender, SelectionChangedEventArgs e)
{
int tabItem = ((sender as TabControl)).SelectedIndex;
if (e.Source is TabControl) // This is a soultion of those problem.
{
switch (tabItem)
{
case 0: // Chatting
Debug.WriteLine("Tab: Chatting");
if (MainChatList.Items.Count > 0)
@KennethanCeyer
KennethanCeyer / .bash_profile
Last active April 4, 2018 02:06
bash_profile for MAC users
#.bash_profile
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
#============================================================
#
# ALIASES AND FUNCTIONS
# Arguably, some functions defined here are quite big.
# If you want to make this file smaller, these functions can