This file contains 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
namespace System.Runtime.CompilerServices | |
{ | |
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)] | |
public sealed class CallerMemberNameAttribute : Attribute | |
{ | |
public CallerMemberNameAttribute() | |
{ } | |
} | |
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)] |
This file contains 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
// Use in VS11 and .NET 4.5 or in VS10 with the Async CTP installed | |
// | |
namespace DataServiceAsyncExtensions | |
{ | |
using System; | |
using System.Collections.Generic; | |
using System.Data.Services.Client; | |
using System.Threading.Tasks; |
This file contains 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
inline Concurrency::task<Platform::String^> ReadStringAsync(Platform::String^ filename) | |
{ | |
using namespace Windows::Storage; | |
using namespace Concurrency; | |
auto folder = Windows::ApplicationModel::Package::Current->InstalledLocation; | |
task<StorageFile^> getFileTask(folder->GetFileAsync(filename)); | |
auto readBufferTask = getFileTask.then([] (StorageFile^ f) |
This file contains 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 IEnumerable<U> SelectProjections<T, U>(this IEnumerable<T> @this, params Func<T, U>[] projections) | |
{ | |
if (@this == null) | |
throw new NullReferenceException(); | |
if (projections == null || !projections.Any()) | |
yield break; | |
foreach (var item in @this) | |
{ | |
foreach (var projection in projections) |
This file contains 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.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace Common | |
{ | |
public interface ISet<T> : ICollection<T>, IEnumerable<T>, IEnumerable | |
{ | |
bool Add(T item); |
This file contains 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
<ResourceDictionary | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | |
<Style x:Key="FloatingHeaderTextBoxStyle" TargetType="TextBox"> | |
<Setter Property="MinWidth" Value="{ThemeResource TextControlThemeMinWidth}"/> | |
<Setter Property="MinHeight" Value="{ThemeResource TextControlThemeMinHeight}"/> | |
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/> | |
<Setter Property="Background" Value="{ThemeResource SystemControlBackgroundAltHighBrush}"/> | |
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundChromeDisabledLowBrush}"/> |
This file contains 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
<div> | |
<h1>Register</h1> | |
<div> | |
<label>Username</label> | |
<input type="text" name="username" /> | |
</div> | |
<div> | |
<label>Password</label> | |
<input type="password" name="password" /> | |
</div> |
This file contains 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
const RegisterForm = ({ | |
username, password, isRegistering, | |
onRegister, set | |
}) => ( | |
<div> | |
<h1>Register</h1> | |
<div> | |
<label>Username</label> | |
<input type="text" name="username" value={username} onChange={set} | |
/> |
This file contains 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
let registration = { | |
username: "", | |
password: "", | |
isRegistering: false, | |
onRegister: r => { | |
// login(r.username, r.password).then()... | |
r.setState({ isRegistering: true }) | |
setTimeout(() => { | |
r.setState({ isRegistering: false }) |
This file contains 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
export const wrap = (state, WrappedComponent) => | |
class extends React.Component { | |
foos = {} | |
state = state || {} | |
set = e => { | |
this.setState({ [e.target.name]: e.target.value }) | |
}; | |
componentWillMount() { |
OlderNewer