Skip to content

Instantly share code, notes, and snippets.

@HungHuynh
HungHuynh / boost.sh
Created March 26, 2014 01:21 — forked from rsobik/boost.sh
#===============================================================================
# Filename: boost.sh
# Author: Pete Goodliffe
# Copyright: (c) Copyright 2009 Pete Goodliffe
# Licence: Please feel free to use this, with attribution
# Modified version
#===============================================================================
#
# Builds a Boost framework for the iPhone.
# Creates a set of universal libraries that can be used on an iPhone and in the
@HungHuynh
HungHuynh / helloworld
Created August 29, 2011 04:05
Node.js : Hello World
var http = require('http')
http.createServer(function (req,res) {
res.writeHead(200, {'Content-Type':'text/plain'});
res.end('Hello World! \n');
}).listen(1337,"127.0.0.1");
console.log('Server running ar http://127.0.0.1:1337//');
@HungHuynh
HungHuynh / Blog post
Created August 29, 2011 12:43
Node.js : blog post
var http = require('http');
var url = require('url');
var fs = require('fs');
var newPostFormHTML = fs.readFileSync('views/post/new.html');
function renderNewPostForm(request, response) {
response.writeHead(200, {
'Content-type': 'text/html; charset=utf-8'
});
@HungHuynh
HungHuynh / sysctl API
Created September 5, 2012 15:30
This struct has information about running processes.You can run it in a loop until to get info about all processes. Here is a code snippet- extend it to get info of all processes
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_ALL;
mib[3] = 0;
ret = sysctl(mib, 4, NULL, &size, NULL, 0);
procs = malloc(size);
ret = sysctl(mib, 4, procs, &size, NULL, 0); /* procs is struct kinfo_proc.*/
@HungHuynh
HungHuynh / getProcess
Created September 5, 2012 15:26
This is code sample about how get process runing background on iOS
#import <sys/sysctl.h>
- (NSArray *)runningProcesses {
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0};
size_t miblen = 4;
size_t size;
int st = sysctl(mib, miblen, NULL, &size, NULL, 0);
@HungHuynh
HungHuynh / UIDevice-Platfform
Created September 6, 2012 03:48
This is function check type device
#include <sys/types.h>
#include <sys/sysctl.h>
@interface UIDevice(Hardware)
- (NSString *) platform;
- (BOOL)hasRetinaDisplay;
- (BOOL)hasMultitasking;
@HungHuynh
HungHuynh / checkDevice
Created September 15, 2012 20:27
Check device simulator or device real
//If it dont simulator :
#if !TARGET_IPHONE_SIMULATOR
#endif
#pragma mark - UIPickerViewDelegate methods
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
}
#pragma mark - UIPickerViewDataSource methods
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
}
@HungHuynh
HungHuynh / DetailViewController.h
Created September 30, 2012 08:27 — forked from anonymous/DetailViewController.h
Simple iOS YouTube App - Use this code to put a list of videos from a YouTube user in your app.
//
// DetailViewController.h
// youtubedemo
//
// Created by Your Name on 4/24/12.
// Copyright (c) 2012 Company Name. All rights reserved.
//
#import <UIKit/UIKit.h>
@HungHuynh
HungHuynh / gist:3913977
Created October 18, 2012 18:34 — forked from andrewzimmer906/gist:3145581
Post Photo and Message wall with Facebook iOS6 SDK
// Start here https://developers.facebook.com/docs/getting-started/getting-started-with-the-ios-sdk/
// Install the Facebook SDK, get it linked up, create an app, and get that setup correctly
// in your info.plist, appDelegate, and build settings.
//Note: This example uses ARC. If you aren't using ARC, made sure to release/retain objects as needed.
//Now for the fun part.
////////////////////////////