Skip to content

Instantly share code, notes, and snippets.

🚀
Hacking

Owen Ou jingweno

🚀
Hacking
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();
View CreteHTMLTextEditor.java
public TextEditor createHTMLTextEditor() {
try {
Class cls = Class
.forName("org.eclipse.wst.sse.ui.StructuredTextEditor");
for (Constructor constructor : cls.getDeclaredConstructors()) {
if (constructor.getGenericParameterTypes().length == 0) {
return (TextEditor) constructor.newInstance(new Object[0]);
}
}
} catch (Throwable throwable) {
View HelloWorldDependency.xml
<dependency>
<groupId>HelloWorld</groupId>
<artifactId>HelloWorldProxy</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
View SourceEditorFactory.java
public class SourceEditorFactory {
private static IConfigurationElement cachedConfigurationElement;
private static final String ATTRIBUTE_CLASS = "class";
public static ITextEditor createSourceEditor() {
if (cachedConfigurationElement == null) {
cachedConfigurationElement = readConfigurationElement();
}
View Baz.java
class Baz implements Serializable {
private A a;
private B b;
private C c;
...
}
View ant.sh
ant -Dbuild.compiler=org.eclipse.jdt.core.JDTCompilerAdapter
-Dant.build.javac.target=1.6
-Dant.build.javac.source=1.6 compile
View tableless_columns.rb
class User < ActiveRecord::Base
include TablelessColumns
tableless_column :license_accepted, :boolean
# other fields that are corresponding to table columns
end
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.