Skip to content

Instantly share code, notes, and snippets.


Owen Ou jingweno

Block or report user

Report or block jingweno

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View transition.php
if ( $controllerHasModel ) {
$model = property_exists($c->{$controllerModel}, $modelName) ? $c->{$controllerModel}->{$modelName} : $c->{$modelName};
if (get_class($model) == 'AppModel') {
if (!class_exists($modelName)) {
App::import('Model', $modelName);
if (!class_exists($modelName)) {
return false;
$model = new $modelName();
public TextEditor createHTMLTextEditor() {
try {
Class cls = Class
for (Constructor constructor : cls.getDeclaredConstructors()) {
if (constructor.getGenericParameterTypes().length == 0) {
return (TextEditor) constructor.newInstance(new Object[0]);
} catch (Throwable throwable) {
View HelloWorldDependency.xml
public class SourceEditorFactory {
private static IConfigurationElement cachedConfigurationElement;
private static final String ATTRIBUTE_CLASS = "class";
public static ITextEditor createSourceEditor() {
if (cachedConfigurationElement == null) {
cachedConfigurationElement = readConfigurationElement();
class Baz implements Serializable {
private A a;
private B b;
private C c;
ant -Dbuild.compiler=org.eclipse.jdt.core.JDTCompilerAdapter compile
View tableless_columns.rb
class User < ActiveRecord::Base
include TablelessColumns
tableless_column :license_accepted, :boolean
# other fields that are corresponding to table columns
module TablelessColumns
def self.included(base)
View redis_pubsub_demo.rb
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
You can’t perform that action at this time.