Skip to content

Instantly share code, notes, and snippets.

View kyktommy's full-sized avatar
🎯
Focusing

kyktommy kyktommy

🎯
Focusing
View GitHub Profile
@kyktommy
kyktommy / test.java
Created August 31, 2012 14:57
test java code snippets
public static void main(String args[]) {
System.out.println("java code from jist <3");
}
class Sale {
int amount;
Sale(int a) {
amount = a;
}
int getAmount() {
return this.amount;
}
public class CreditCardPayment implements Payment {
int amount;
CreditCardPayment() {
this.amount = 500;
}
public int calcAmount() {
return amount - sale.getAmount();
}
public boolean authorize() {
return true;
@kyktommy
kyktommy / tumblrGist.js
Created December 2, 2012 06:48
Tumblr using Gist
var gistPrefix = 'https://gist.github.com/',
cachedWrite = document.write,
body = $('body'),
gists = $('a').map(function(n, a) {
a = $(a);
var href = a.attr('href');
if (href.indexOf(gistPrefix) == 0) {
return {
a: a,
id: href.substring(gistPrefix.length)
@kyktommy
kyktommy / index.html
Created December 3, 2012 07:06
HTML fundamental part 1
<!doctype html>
<html>
<head>
<title>TOMMY's Blog</title>
</head>
<body>
<h1>TOMMY's Blog</h1>
<div>
<h3>Post 1</h3>
<p>here is some post content : )</p>
@kyktommy
kyktommy / gist:4357403
Created December 22, 2012 03:46
Ruby Bits 2 Notes
# inline each block
games.each &block
# Symbol#to_proc
games.map &:name
# orginal:
# games.map {|g| g.name }
# Need to enroll for ch.2 ...wtf
@kyktommy
kyktommy / try_git.rb
Created December 22, 2012 04:06
Try Git Notes
# local
git init
git status
git add .
git commit -m "add *"
git log
git rm '*.txt'
#remote
@kyktommy
kyktommy / responsive_bookmark.js
Last active December 10, 2015 14:58
Responsive test bookmark
javascript:document.write(%27%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3Cmeta%20charset%3D%22utf-8%22%3E%3Ctitle%3EResponsive%20Design%20Testing%3C/title%3E%3Cstyle%3Ebody%20%7B%20margin:%2020px%3B%20font-family:%20sans-serif%3B%20overflow-x:%20scroll%3B%20%7D.wrapper%20%7B%20width:%206000px%3B%20%7D.frame%20%7B%20float:%20left%3B%20%7Dh2%20%7B%20margin:%200%200%205px%200%3B%20%7Diframe%20%7B%20margin:%200%2020px%2020px%200%3B%20border:%201px%20solid%20%23666%3B%20%7D%3C/style%3E%3C/head%3E%3Cbody%3E%3Cdiv%20class%3D%22wrapper%22%3E%3Cdiv%20class%3D%22frame%22%3E%3Ch2%3E240%3Cspan%3E%20x%20320%3C/span%3E%20%3Csmall%3E(mobile)%3C/small%3E%3C/h2%3E%3Ciframe%20src%3D%22%27%20%2B%20window.location%20%2B%20%27%22%20sandbox%3D%22allow-same-origin%20allow-forms%22%20seamless%20width%3D%22240%22%20height%3D%22320%22%3E%3C/iframe%3E%3C/div%3E%3Cdiv%20class%3D%22frame%22%3E%3Ch2%3E320%3Cspan%3E%20x%20480%3C/span%3E%20%3Csmall%3E(mobile)%3C/small%3E%3C/h2%3E%3Ciframe%20src%3D%22%27%20%2B%20window.location%20%2B%20%27%22
@kyktommy
kyktommy / hdc.java
Last active December 13, 2015 18:18
public String compress(String str) {
String result = "";
List<String> nodes = new ArrayList<String>();
Pattern pattern = Pattern.compile("(.)\\1{1,}");
Matcher m = pattern.matcher(str);
int offset = 0;
while( m.find() ) {
int start = m.start();
int end = m.end();
@kyktommy
kyktommy / menu.java
Last active December 13, 2015 18:59
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class menu {
public static void main(String[] args) {