Skip to content

Instantly share code, notes, and snippets.

View owenthereal's full-sized avatar
🚀
Hacking

Owen Ou owenthereal

🚀
Hacking
View GitHub Profile
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();
Hello from GitHub Gist Wordpress Plugin!
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) {
<dependency>
<groupId>HelloWorld</groupId>
<artifactId>HelloWorldProxy</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
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
-Dant.build.javac.target=1.6
-Dant.build.javac.source=1.6 compile
- build_config
- build.properties
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)
# 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