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 partial class MyContext | |
{ | |
private static Dictionary<Type, EntitySetBase> _mappingCache = | |
new Dictionary<Type, EntitySetBase>(); | |
private string GetTableName(Type type) | |
{ | |
EntitySetBase es = GetEntitySet(type); | |
return string.Format("[{0}].[{1}]", |
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
<span data-bind="text: Name"></span> | |
var ViewModel = new function() { | |
var self = this; | |
self.Name = ko.observable("Sample User"); | |
} | |
ko.applyBindings(ViewModel); |
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 ViewModel = new function() { | |
var self = this; | |
self.Name = ko.observable("Sample User"); | |
self.DateOfBirth = ko.observable(); | |
} | |
ko.applyBindings(ViewModel); | |
<span data-bind="text: Name"></span> | |
<span data-bind="dateString: DateOfBirth, datePattern: 'MM/DD/YYYY'"></span> |
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
ko.bindingHandlers.dateString = { | |
update: function (element, valueAccessor, allBindingsAccessor, viewModel) { | |
var value = valueAccessor(), | |
allBindings = allBindingsAccessor(); | |
var valueUnwrapped = ko.utils.unwrapObservable(value); | |
var pattern = allBindings.datePattern || 'mmmm d, yyyy'; | |
if (valueUnwrapped == undefined || valueUnwrapped == null) { | |
$(element).text(""); | |
} | |
else { |
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
#import | |
@interface CustomUITableViewCell : UITableViewCell | |
{ | |
NSMutableArray *columns; | |
} | |
- (void)addColumn:(float)column; | |
@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
- (void)drawRect:(CGRect)rect | |
{ | |
[super drawRect:rect]; | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
CGRect rect = self.bounds; | |
UIColor *separatorColor = [UIColor colorWithRed:208.0/255.0 green:208.0/255.0 blue:208.0/255.0 alpha:1.0]; | |
for (int i = 0; i < [columns count]; i++) | |
{ |
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
using System; | |
using System.Diagnostics; | |
using Ploeh.AutoFixture; | |
namespace ConsoleApplication1 | |
{ | |
class Program // by Roman Pushkin - roman.pushkin/at/gmail | |
{ | |
static void Main(string[] args) | |
{ |
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
=== Buggy === | |
class EmailAddress | |
include Comparable | |
def initialize(string) | |
if string =~ /@/ | |
@raw_email_address = string.downcase.strip | |
else | |
raise ArgumentError, "email address must have an '@'" |
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
*********** | |
*** (1) *** | |
*********** | |
=== html === | |
... | |
<body> | |
<div class="component-a"> | |
</div> |
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
if (Meteor.isClient) { | |
// counter starts at 0 | |
Session.setDefault('counter', 0); | |
Template.hello.helpers({ | |
counter: function () { | |
return Session.get('counter'); | |
} | |
}); |