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
// Module dependencies | |
var crypto = require('crypto'), | |
express = require('express'), | |
hbs = require('express-hbs'), | |
fs = require('fs'), | |
uuid = require('node-uuid'), | |
Polyglot = require('node-polyglot'), | |
semver = require('semver'), | |
_ = require('lodash'), | |
when = require('when'), |
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
var frontend = require('../controllers/frontend'); | |
module.exports = function (server) { | |
/*jslint regexp: true */ | |
// ### Frontend routes | |
server.get('/rss/', frontend.rss); | |
server.get('/rss/:page/', frontend.rss); | |
server.get('/page/:page/', frontend.homepage); | |
server.get('/blog/', frontend.homepage); |
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
Array.prototype.max = function() { | |
return Math.max.apply(Math, this); | |
}; | |
[1,2,3].max(); // => 3 | |
Array.prototype.all = function() { | |
return [].every.apply(this, [].slice.call(arguments)); | |
}; |
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
(mergesort [6 4 2 3 5 1]) | |
(defn mergesort [x] | |
(if (< (count x) 2) x | |
(let [half (quot (count x) 2)] | |
(merge (mergesort (take half x)) (mergesort (drop half x)))))) | |
(defn merge[a, b] | |
(if (empty? a) b | |
(if (empty? b) a |
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 (FolderBrowserDialog browseDialog = new FolderBrowserDialog()) | |
{ | |
if (browseDialog.ShowDialog() == DialogResult.OK) | |
{ | |
m_Path.Text = browseDialog.SelectedPath; | |
} | |
} |
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
// ReSharper disable CheckNamespace | |
namespace System.Runtime.CompilerServices | |
// ReSharper restore CheckNamespace | |
{ | |
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] | |
public sealed class CallerMemberNameAttribute : Attribute | |
{ | |
} | |
} |
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
/// <summary> | |
/// Interaction logic for App.xaml | |
/// </summary> | |
public partial class App : Application | |
{ | |
... | |
protected override void OnStartup(StartupEventArgs e) | |
{ | |
EventManager.RegisterClassHandler(typeof(TextBox), UIElement.GotFocusEvent, new RoutedEventHandler(TextBox_GotFocus)); |
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
InitializeComponent(); | |
Loaded += (sender, e) => MoveFocus(new TraversalRequest(FocusNavigationDirection.Next)); |
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 abstract class ViewModel : INotifyPropertyChanged | |
{ | |
public event PropertyChangedEventHandler PropertyChanged; | |
[NotifyPropertyChangedInvocator] | |
protected void RaisePropertyChanged([CallerMemberName] string propertyName = string.Empty) | |
{ | |
if (propertyName = string.Empty) | |
{ | |
throw new NotSupportedException("Cannot raise property changed on an empty property name. Make sure you are using the C# 5 compiler to make CallerMemberName work.") |
NewerOlder