Skip to content

Instantly share code, notes, and snippets.

View codewithcats's full-sized avatar
🐱
Building something big

Tanawat Tassana codewithcats

🐱
Building something big
View GitHub Profile
var outerValue = 'ninja';
var later;
function outerFunction() {
var innerValue = 'samurai';
function innerFunction() {
assert(outerValue,"I can see the ninja.");
assert(innerValue,"I can see the samurai");
}
later = innerFunction;
}
@codewithcats
codewithcats / gist:1532424
Created December 29, 2011 06:42
index.jsp script
var errorMsgs = {
txtUSER_NAME: '- โปรดระบุ <bean:message bundle="<%=com.wealth.sellingagent.controller.DefaultDisplay.language%>" key="label.username"/>',
txtPASSWORD: '- โปรดระบุ <bean:message bundle="<%=com.wealth.sellingagent.controller.DefaultDisplay.language%>" key="label.password"/>'
};
$('#loginForm').validate({
onfocusout: false,
onkeyup: false,
onclick: false,
rules: {
txtUSER_NAME: 'required',
class Circle {
private float radius;
private String color;
public float getDiameter() {
// what is "this" ?
}
}
@codewithcats
codewithcats / Device_after.cs
Created April 16, 2012 16:55
Team 1 Lv 1: Src
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ECal.Core
{
public class Device
{
private string name;
@codewithcats
codewithcats / CalUnit.cs
Created April 17, 2012 21:02
Calculate Unit Per Day
public int calUnit()
{
decimal result = Convert.ToDecimal((Power / 1000.00) * Duration);
string[] str;
int font;
if (result.ToString().Contains('.'))
{
str = result.ToString().Split('.');
font = Convert.ToInt32(str[0]);
if (Convert.ToInt32(str[1]) > 0)
@codewithcats
codewithcats / CalUnit.java
Created April 17, 2012 22:47
Calculate Unit Per Day - Team 8
public int calUnit() {
double realval = (this.power / 1000.00) * this.duration;
int tem = (int) realval;
if (realval - tem != 0) {
tem += 1;
}
return tem;
}
@codewithcats
codewithcats / CalUnit.java
Created April 17, 2012 23:02
Calculate Unit Per Day - Team 6
public int calUnit() {
BigDecimal power = new BigDecimal(this.power);
BigDecimal duration = new BigDecimal(this.duration);
BigDecimal result = power.divide(new BigDecimal("1000.00")).multiply(duration);
String ans = result.setScale(0,BigDecimal.ROUND_UP).toString();
return Integer.parseInt(ans);
}
namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter05.Listing05_43
{
class Employee
{
public Employee(int id)
{
Id = id;
}
// ...
namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter05.Listing05_44
{
using System;
class Program
{
// Define a nested class for processing the command line.
private class CommandLine
{
public CommandLine(string[] arguments)
namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter05.Listing05_47
{
using System;
// File: Person.Designer.cs
public partial class Person
{
#region Extensibility Method Definitions
partial void OnLastNameChanging(string value);
partial void OnFirstNameChanging(string value);
#endregion