Skip to content

Instantly share code, notes, and snippets.

View NamXH's full-sized avatar

Nam Hoang NamXH

  • Canada
View GitHub Profile
@NamXH
NamXH / keyrepeat.shell
Created January 30, 2017 23:36 — forked from kconragan/keyrepeat.shell
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
public static class CartonConstants
{
public static readonly int LengthInInch = 18;
public static readonly int WidthInInch = 18;
public static readonly int HeightInInch = 8;
}
public class Solution
{
public bool ValidateLength(string lengthStr)
public class Main {
public static void main(String[] args) {
System.out.println("Hello World!");
System.out.println(Fibonacci(0));
System.out.println(Fibonacci(1));
System.out.println(Fibonacci(2));
System.out.println(Fibonacci(15));
}
import java.io.Console;
public class Main {
public static void main(String[] args) {
// For test
String s = " Hello world ! ";
String s2 = "";
String s3 = null;
String s4 = "1";
using System;
namespace StringReverseWordOrder
{
class MainClass
{
public static void Main(string[] args)
{
var s = " Hello world ! ";
var s2 = "";
using System;
namespace Fibonacci
{
class MainClass
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
Console.WriteLine(Fibonacci(0));
@NamXH
NamXH / EasyLayoutExample.cs
Created April 9, 2016 06:47 — forked from praeclarum/EasyLayoutExample.cs
Here is an example of using my [EasyLayout](https://gist.github.com/praeclarum/6225853) library. Note the use of <= and >=, these are very difficult to write in old fashioned (frame-based) layout code. Also note the extension method GetMidY() that emulates Center.Y. You can also use GetBaseline() that works for baseline-aware views.
ContentView.ConstrainLayout (() =>
border.Frame.Top == ContentView.Frame.Top &&
border.Frame.Height == 0.5f &&
border.Frame.Left == ContentView.Frame.Left &&
border.Frame.Right == ContentView.Frame.Right &&
nameLabel.Frame.Left == ContentView.Frame.Left + hpad &&
nameLabel.Frame.Right == ContentView.Frame.GetMidX () - 5.5f &&
nameLabel.Frame.Top >= ContentView.Frame.Top + vpad &&
@NamXH
NamXH / EasyLayout.cs
Created April 9, 2016 06:46 — forked from praeclarum/EasyLayout.cs
EasyLayout makes writing auto layout code in Xamarin.iOS easier. See [the example](https://gist.github.com/praeclarum/8185036) for hints on how to use this library.
//
// Copyright (c) 2013-2015 Frank A. Krueger
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
#################
## Eclipse
#################
*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
g_LastCtrlKeyDownTime := 0
g_AbortSendEsc := false
g_ControlRepeatDetected := false
*CapsLock::
if (g_ControlRepeatDetected)
{
return
}