Skip to content

Instantly share code, notes, and snippets.

View chrisjlee's full-sized avatar
💭
🏈

Chris J. Lee chrisjlee

💭
🏈
View GitHub Profile
@chrisjlee
chrisjlee / Person.java
Last active August 29, 2015 13:56
Declaring a Person object in all various computer programming languages.
public class Person {
private String name;
private String age;
private String gender;
Person(String Name, String Age, String Gender) {
this.age = Age;
this.gender = Gender;
this.name = Name;
}
@chrisjlee
chrisjlee / select-options.java
Created February 11, 2014 20:10
Selenium: Retrieve option items from select list - found via https://groups.google.com/forum/#!topic/selenium-users/KxHTqpCFyWY
@import java.util;
@import org.openqa.selenium.By;
@import org.openqa.selenium.WebDriver;
@import org.openqa.selenium.Keys;
driver.findElement(By.xpath("//select[@id='categoryId']")).sendKeys("Foo");
// For more info Please find the below code
WebElement droplist = driver.findElement(By.xpath("//select[@id='categoryId']"));
@chrisjlee
chrisjlee / functions.php
Created February 12, 2014 04:29
Add livereload to wordpress theme using the functions.php file.
<?php
if ( $_SERVER['REMOTE_ADDR'] === '127.0.0.1' ){
add_action( 'wp_enqueue_scripts', 'enqueue_livereload' );
}
function enqueue_livereload(){
wp_enqueue_script( 'livereload', site_url().'/livereload.js', '', NULL );
}
@chrisjlee
chrisjlee / app.js
Last active August 29, 2015 13:56
Enter / leave
var app = angular.module("app", ["ngAnimate"]);
app.controller("AppCtrl", function() {
this.toggle = true;
});
app.animation(".toggle", function () {
return {
leave: function (element, done) {
element.text("leave");
<div id="consolelog" style="font-family: 'Courier New', Courier, monospace; font-size: 12px; margin: 40px 30px 0px; background-color: white; border: 2px solid black; padding: 10px;"></div>
<input type="text" id="consoleinput" style="margin: 0px 30px; width: 400px;" onkeypress="return evalConsoleInput(event, this.value);" />
<script type="text/javascript">
var appendConsole = function(message, type) {
var color = "black";
if (type === "error") {
color = "red";
} else if (type === "debug") {
@chrisjlee
chrisjlee / char.java
Created March 7, 2014 06:07
OCAJCP questions - char types
// 2.1.3 - Chars
char c2 = '122'; // Does this compile? What does this become?
char c2 = '\u0122'; // Does this compile; if so what is the value
javascript:(function(){if((/android/gi).test(navigator.appVersion)){console={"_log":[],"log":function(){var%20arr=[];for(var%20i=0;i<arguments.length;i++){arr.push(arguments[i]);}this._log.push(arr.join(",%20"));},"trace":function(){var%20stack;try{throw%20new%20Error();}catch(ex){stack=ex.stack;}console.log("console.trace()\n"+stack.split("\n").slice(2).join("%20%20\n"));},"dir":function(obj){console.log("Content%20of%20"+obj);for(var%20key%20in%20obj){var%20value=typeof%20obj[key]==="function"?"function":obj[key];console.log("%20-\""+key+"\"%20->%20\""+value+"\"");}},"show":function(){alert(this._log.join("\n"));this._log=[];}};window.onerror=function(msg,url,line){console.log("ERROR:%20\""+msg+"\"%20at%20\""+"\",%20line%20"+line);}window.addEventListener("touchstart",function(e){if(e.touches.length===3){console.show();}});}})();
@chrisjlee
chrisjlee / gist:9746949
Created March 24, 2014 19:08
Oneline chrome in browser editor. Put this in your awesomebar: http://lifehacker.com/5980134/turn-any-browser-window-into-a-quick-edit-notepad
data:text/html, <html contenteditable>
@chrisjlee
chrisjlee / README.md
Last active August 29, 2015 13:58
Using the YUI namespace function to create a javascript module

The design of this has some issues. It requires calling YUI use for each public / private method. Nonethless, this is how you setup a javascript module using module pattern and YUI namepsace.

var gulp = require("gulp");
var path = require("path");
var server = {
port: 4000,
livereloadPort: 35729,
basePath: path.join(__dirname, "www"),
_lr: null,
start: function () {
var express = require('express');