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 pusher-travis-client.rb
require 'pusher-client'
socket = PusherClient::Socket.new('5df8ac576dcccf4fd076')
socket.subscribe('common')
handler = lambda do |event, data|
p [event, data]
end
events = ['job:created', 'job:started', 'job:finished', 'job:canceled',
@jingweno
jingweno / grep_cellar
Last active Aug 29, 2015
grep_cellar
View grep_cellar
$ pwd
/opt/boxen/homebrew/Library/Formula
$ grep -ri "Cellar" *
argp-standalone.rb: cellar :any
aria2.rb: cellar :any
asciidoc.rb: cellar :any
at-spi2-atk.rb: cellar :any
autojump.rb: . /usr/local/Cellar/gautojump/HEAD/etc/autojump.fish
bagit.rb: # put logs in var, not in the Cellar
View diff.diff
diff --git a/commands/init.go b/commands/init.go
index ef55871..d63de61 100644
--- a/commands/init.go
+++ b/commands/init.go
@@ -1,8 +1,6 @@
package commands
import (
- "path/filepath"
-
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;
...
}
You can’t perform that action at this time.