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
// Start of code | |
private string customMessage = "My lovely heading"; | |
[WebBrowsable(true), | |
Category("GRP Custom"), | |
WebDescription("Displays a custom message"), | |
WebDisplayName("Display Message"), | |
Personalizable(PersonalizationScope.User)] |
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
// Start of code | |
protected override void RenderContents(HtmlTextWriter writer) | |
{ | |
// Writing a simple h1 | |
// You have to prepare your tag attributes before opening the tag | |
writer.AddAttribute(HtmlTextWriterAttribute.Id, "my_h1"); | |
// Open h1 tag |
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
// Start of code | |
protected override void CreateChildControls() | |
{ | |
base.CreateChildControls(); | |
// Form label | |
Label qLabel = new Label(); | |
qLabel.Text = "Label text"; |
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
javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.3.2",function($,L){su=$("link[rev=canonical]").attr("href");su===undefined?alert("No%20short%20url!%20Try%20viewing%20the%20image%20directly,%20outside%20of%20any%20set."):alert(su);}); |
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 app = $.sammy(function() { | |
var context = this; | |
this.get('#/', function() { | |
this.trigger('myEvent', { h1: 'My app', text: 'world' }); | |
}); | |
this.bind('myEvent', function(e, opts) { | |
$('h1').html(opts.h1); |
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
function DoTooMuchStuff(num) { | |
$('p#mypar_'+num).slideUp(400).remove(); | |
$('h3#myheading_'+num).html('No records found'); | |
context.trigger('updateStoredRecords', { remove: num }); | |
var delimiter = ($('ul#removed > li').size() > 0) ? ', ' : ''; | |
$('ul#removed').append($('<li/>').html(delimiter+GetName(num))); | |
}; |
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
def smallest_temperature_spread | |
# store all munged values in a hash | |
map = {} | |
File.open("weather.dat", "r") do |file| | |
# iterate each line | |
while line = file.gets | |
# only use relevant lines | |
if line.match(/^\s+\d+\s+[\d\*]+\s+/) | |
# seems appropriate to convert keys to integers here for possible future use |
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
Name | Department | Manager | Salary | |
---|---|---|---|---|
Robin Hood | 200 | |||
Arsene Wenger | Bar | Friar Tuck | 50 | |
Friar Tuck | Foo | Robin Hood | 100 | |
Little John | Foo | Robin Hood | 100 | |
Sam Allardyce | 250 | |||
Dimi Berbatov | Foo | Little John | 50 |
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
toHaveEvent: function(eventType){ | |
return (this.actual.data('events')) && (typeof this.actual.data('events')[eventType] == 'object'); | |
} |
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
10.times { City.cities_in_country("RU") } | |
Benchmark.bm | |
------------ | |
user system total real | |
JSON 33.210000 0.630000 33.840000 ( 33.872267) | |
YAML 78.530000 3.230000 81.760000 ( 81.758585) | |
Benchmark.bmbm | |
-------------- |