This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a Signal without specific Value Classes | |
var signal:Signal = new Signal(); | |
// Add listeners | |
signal.add(myListener); | |
signal.add(myOtherListener); | |
// Dispatch signal | |
signal.dispatch(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bb = null; | |
function drawRect(e) | |
{ | |
var elm = e.target; | |
// fixes for 'use' elements | |
if(!elm.getBBox) | |
{ | |
if(elm.correspondingUseElement) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClass | |
# All of these are equivalent | |
def self.myMethod | |
true | |
end | |
def MyClass.myMethod | |
true | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SelfStudy | |
attr_accessor :name | |
def self | |
@name | |
end | |
def self.name | |
@name | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void printMap(Map mp) { | |
Iterator it = mp.entrySet().iterator(); | |
while (it.hasNext()) { | |
Map.Entry pairs = (Map.Entry)it.next(); | |
System.out.println(pairs.getKey() + " = " + pairs.getValue()); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Proj.View.CustomView2 = Proj.View.CustomView.extend({ | |
initialize: function(opts) { | |
//this is the equivalent of super() | |
Proj.View.CustomView.prototype.initialize.call(this,opts); | |
//.... | |
}, | |
render: function(opts) { | |
//this is the equivalent of super() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// thanks to http://eriwen.com/javascript/js-stack-trace/ | |
function printStackTrace() { | |
var callstack = []; | |
var isCallstackPopulated = false; | |
try { | |
i.dont.exist+=0; //doesn't exist- that's the point | |
} catch(e) { | |
if (e.stack) { //Firefox | |
var lines = e.stack.split('\n'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bestOf ("Java","Python") == "Groovy" ? "YES" : "NO" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//via //http://www.google.com/codesearch#VcEPaUaJ3Zo/trunk/spring/org.springframework.context.support/src/main/java//org/springframework/mail/javamail/JavaMailSenderImpl.java&q=JavaMailSenderImpl&type=cs | |
public void send(MimeMessagePreparator mimeMessagePreparator) throws MailException { | |
send(new MimeMessagePreparator[] { mimeMessagePreparator }); | |
} | |
public void send(MimeMessagePreparator[] mimeMessagePreparators) throws MailException { | |
try { | |
List<MimeMessage> mimeMessages = new ArrayList<MimeMessage>(mimeMessagePreparators.length); | |
for (MimeMessagePreparator preparator : mimeMessagePreparators) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//binding an event listener to respond when the url has been changed | |
router.bind("route:help", function(page) { | |
... | |
}); |