Skip to content

Instantly share code, notes, and snippets.

View macbaszii's full-sized avatar
🏠
Working from home

iMacbaszii macbaszii

🏠
Working from home
View GitHub Profile
@macbaszii
macbaszii / LinkedList.cpp
Created December 3, 2012 05:18
[C/C++] LinkedList and Queue, Stack Implemented
#include <iostream>
using namespace std;
struct Node
{
int data;
Node *next;
};
struct HeadNode
@macbaszii
macbaszii / .gitignore
Created January 7, 2013 14:35
Git Ignore File for iOS Project
# Exclude the build directory
build/*
# Exclude temp nibs and swap files
*~.nib
*.swp
# Exclude OS X folder attributes
.DS_Store
@macbaszii
macbaszii / .gitignore
Created January 7, 2013 14:35
Git Ignore File for Rails Project
*.rbc
*.sassc
.sass-cache
capybara-*.html
.rspec
.rvmrc
/.bundle
/vendor/bundle
/log/*
/tmp/*
test = gets.chomp.to_i
test.times do |t|
table = []
n = 3
4.times { table << gets.chomp }
dummy = gets.chomp
x_win = o_win = false
@macbaszii
macbaszii / atkAlgor.js
Created September 6, 2013 18:42
** Code นี้ใช้ Underscore Module ด้วยนะ ใช้ node รันแล้วเกิด error /Users/iMacbaszii/Desktop/atkAlgor.js:59 if (opponentArray[monster.position - 1 + i].isDead) { ^ TypeError: Cannot read property 'isDead' of undefined ก็เลยลอง Debug ดูปรากฎว่าแม้ position จะเป็น 4, 5, 6 มันเข้า if (isFrontMonster(monster)) ตลอดเลย = =' ซึ่งจริงแล้วมันไม่ควรเข้าไ…
var _ = require("underscore")
monsterArray = [{ type: "Attacker", position: 1, isDead: false},
{ type: "Attacker", position: 2, isDead: false},
{ type: "Attacker", position: 3, isDead: false},
{ type: "Attacker", position: 4, isDead: false},
{ type: "Attacker", position: 5, isDead: false},
{ type: "Attacker", position: 6, isDead: false}];
opponentArray = [{ type: "Attacker", position: 1, isDead: false},
@macbaszii
macbaszii / index.html
Last active December 24, 2015 17:39
Simple Chat Front End
<script src="/socket.io/socket.io.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
var socket = io.connect('http://localhost:8080');
// on connection to server, ask for user's name with an anonymous callback
socket.on('connect', function(){
// call the server-side function 'adduser' and send one parameter (value of prompt)
socket.emit('adduser', prompt("What's your name?"));
});
@macbaszii
macbaszii / swift.md
Last active August 29, 2015 14:13 — forked from varokas/swift.md

Assignment

let constant = "Constant cannot be changed"
var variable = "Variable can be changed later"

var x,y: Int
let x = 0, y = 0

Types

NSInteger x = 30;
CGFloat y = (CGFloat)x;
let pi: Double = 3.14159
let fpi: Float = 3.14159
let x = Int(pi) // 3
let dpi = Double(pi)
let dgf = CGFloat(pi)
let array = Array("abc") // array = ["a", "b", "c"]
let string = String(["a", "b", "c", "d"]) // string = "abcd"
let intConvert = String(44) // let's try String(37.5)
// AnyObject might be used in this way
// Properties
var destinationViewController: AnyObject
var toolbarItems: [AnyObject]
// Function or Method Arguments
func prepareForSegue(segue: UIStoryboardSegue, sender AnyObject)
func addConstraints(constraints: [AnyObject])
func appendDigit(sender: AnyObject)