Skip to content

Instantly share code, notes, and snippets.

format.xml { render :xml => @post }
format.plist {
send_data(
@post.to_plist,
:type => "application/plist",
:filename => "post-#{@post.id}.plist",
:disposition => 'inline'
)
}
class Jeena
def Jeena::tuwas
puts "klassenmethode"
end
def tuwas
puts "instanzmethode"
end
end
- (void)postNewEntry {
NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:
@"A title", @"title",
@"Some text for body", @"body", nil];
NSData *data = [NSPropertyListSerialization dataFromPropertyList:dict
format:NSPropertyListBinaryFormat_v1_0
errorDescription:nil];
#!/usr/bin/lua
secretword = "llama" -- the secret word
write ("What is your name? ")
name = read ("*l")
if name == "Randal" then
print ("Hello, Randal! How good of you to be here!")
else
<div id="preview"></div>
<%= javascript_include_tag ["showdown"] %>
<script>
document.observe("dom:loaded", function() {
var converter = new Showdown.converter();
$("post_content").observe("keyup", function(e) {
$("preview").innerHTML = converter.makeHtml($("post_content").value);
});
- (void)openMoreAfterDelay:(id)sender {
UIMenuController *menuController = [UIMenuController sharedMenuController];
[self becomeFirstResponder];
NSMutableArray *menuItems = [[NSMutableArray alloc] initWithCapacity:5];
UIMenuItem *item;
NSInteger i = 0;
for (SquaceMLAction *action in [[dataSource.squaceML.squaregrid.squares objectAtIndex:activeIndex] actions]) {
module LocalizedAttributes
def localize(*methods)
methods.each do |method|
class_eval %Q[
def #{method}
text = self.send(("#{method}_" << I18n.locale.to_s.downcase).to_sym)
text = self.#{method}_#{I18n.default_locale.to_s.downcase} if text.blank?
text
end
<!DOCTYPE html>
<html>
<head>
<title>test</title>
<script type="text/javascript" charset="utf-8">
var t = 1;
</script>
</head>
<body onload="start()">
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
function fireEvent(obj,evt){
var evObj = document.createEvent('MouseEvents');
evObj.initEvent( evt, true, false );
obj.dispatchEvent(evObj);
}
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script>
var obj = {
a: 0,
add: function () {
console.log("a: " + this.a);
}