Skip to content

Instantly share code, notes, and snippets.

// C programming
#include <stdio.h>
#define IN 1
#define OUT 0
int main(int argc, char const *argv[])
{
int c, i, nwhite, nother;
@lengocgiang
lengocgiang / STDINCompileC.sublime-build
Last active March 25, 2016 09:24
Console input with terminal
{
"cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' && open -a Terminal.app '${file_path}/${file_base_name}'"],
"selector" : "source.c",
"shell" : false,
"working_dir" : "$file_path"
}
@lengocgiang
lengocgiang / textviewautolayout.swift
Last active May 31, 2020 06:14
UITextView height with AutoLayout( SnapKit)
// I'm using snapkit
// You can add to viewDidLoad
let address = UITextView(frame: CGRectZero)
address.text = restaurant.address
let sizeThatFits = address.sizeThatFits(CGSize(width: view.frame.width, height: CGFloat(MAXFLOAT)))
mainView.addSubview(address)
address.snp_makeConstraints { (make) -> Void in
let superview = mainView
make.top.equalTo(superview.snp_top)
make.left.equalTo(superview.snp_left)