Skip to content

Instantly share code, notes, and snippets.

View tuantmdev's full-sized avatar

Tuan Tran Manh tuantmdev

View GitHub Profile
@tuantmdev
tuantmdev / escpos-command.txt
Created October 4, 2021 12:37
ESC/POS Command
# Printer hardware
HW_INIT = [ 0x1b, 0x40 ] # Clear data in buffer and reset modes
HW_SELECT = [ 0x1b, 0x3d, 0x01 ] # Printer select
HW_RESET = [ 0x1b, 0x3f, 0x0a, 0x00 ] # Reset printer hardware
# Feed control sequences
CTL_LF = [ 0x0a ] # Print and line feed
CTL_FF = [ 0x0c ] # Form feed
CTL_CR = [ 0x0d ] # Carriage return
CTL_HT = [ 0x09 ] # Horizontal tab
import android.text.TextUtils;
import io.realm.Case;
import io.realm.Realm;
import io.realm.RealmObject;
import io.realm.RealmResults;
public class RealmFullTextSearch {
public static <T extends RealmObject> RealmResults<T> search(Realm realm, Class<T> modelClass, String query, String fieldName, boolean partialSearch){
@tuantmdev
tuantmdev / iterm2-solarized.md
Created December 25, 2017 04:58 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@tuantmdev
tuantmdev / git-conventions.md
Last active July 8, 2016 08:24
Git conventions and best practices

Git conventions

Github workflow

IMPORTANT!! Everything you need to know about this amazing workflow in here: Github guides

Commit message

Format of the commit message

Objective-C Coding Convention and Best Practices

Most of these guidelines are to match Apple's documentation and community-accepted best practices. Some are derived some personal preference. This document aims to set a standard way of doing things so everyone can do things the same way. If there is something you are not particularly fond of, it is encouraged to do it anyway to be consistent with everyone else.

This document is mainly targeted toward iOS development, but definitely applies to Mac as well.

Operators

NSString *foo = @"bar";
@tuantmdev
tuantmdev / Breakpoints_v2.xcbkptlist
Created January 6, 2016 08:19 — forked from Ashton-W/Breakpoints_v2.xcbkptlist
My User Breakpoints_v2.xcbkptlist
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "2"
version = "2.0">
<Breakpoints>
<!-- All Exceptions -->
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
#import <objc/runtime.h>
@implementation UIViewController (Tracking)
+ (void)load {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Class class = [self class];
SEL originalSelector = @selector(viewWillAppear:);
@tuantmdev
tuantmdev / UIApplication+PhoneCapability.h
Created November 6, 2015 05:05 — forked from maciekish/UIApplication+PhoneCapability.h
UIApplication+PhoneCapability. Detects whether the device can actually place a phone call.
//
// UIApplication+PhoneCapability.h
//
// Copyright (c) 2014 Maciej Swic
// 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
@tuantmdev
tuantmdev / .gitignore
Created November 6, 2015 04:55
Git ignore file for Objective C project
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData
## Various settings
*.pbxuser
@tuantmdev
tuantmdev / build-universal-framework.sh
Created November 6, 2015 04:46
Script to build universal framework (Simulator and device support)
#!/bin/sh
#######################################
# Step 0. Prepare framework
# - Open Build Settings, Change Mach-O Type -> Static Library
# - Add User-Defined Settings with key "CODE_SIGNING_REQUIRED" and value "NO" (Without quote)
# - Add these item to Architectures key i386, armv7, armv7s, x86_64, arm64
# - Create new target with Aggregate template