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
#include <iostream> | |
using namespace std; | |
void theWrapperFunction(int (*fnc) ()) { | |
cout << fnc(); | |
} | |
int theCallBackFunction() { | |
return 12345; | |
} |
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 p = function() { | |
console.log("Executing the callback function"); | |
} | |
var c = function(callBack) { | |
console.log("Executing the wrapper function"); | |
} | |
c(p); |
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 c = "it ws a #nice and #sunny day in Berlin"; | |
c.match(/\B#\w*[a-zA-Z]\w*/g); //should return #nice and #sunny |
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
/* we are using the assumption that every entity is constructed recursively as every child component is given an id of +1 | |
so it could be that my id is #5, but if I have 7 child components, the ID of my next neighbor (the next entity constructed by my parent, which is on the same tree level ) will be #13, because I will be constructed recursively to the lowest level first */ | |
public static void sendMessage(String methodName, Object args) | |
{ | |
int id = 5; | |
int parentId = 0; |
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) { | |
... | |
}); |
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
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
// 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
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
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()); | |
} | |
} |