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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
<script src="https://unpkg.com/hyperhtml@2.10.1/min.js"></script> | |
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script> | |
</head> |
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 strict'; | |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | |
function _inherits(subClass, superClass) { if |
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
private string TemplateTable(Dictionary<string, string> dict) | |
{ | |
var rowTemplate = new Func<string, string, string>((key, value) => $"<tr><td>{key}</td><td>{value}</td></tr>"); | |
return $"<table>{String.Join(Environment.NewLine, dict.Select(t => rowTemplate(t.Key, t.Value)))}</table>"; | |
} | |
private string PageTemplate(SomeModel model) | |
{ | |
var liTemplate = new Func<string, string, string>((key, value) => !string.IsNullOrEmpty(value) ? $"<li><strong>{key}</strong>{value}</li>" : ""); | |
return $@"<html> |
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
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage | |
@{ | |
Layout = null; | |
} | |
@functions{ | |
/* | |
* Poor mans "Code First" implementation for Umbraco |
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 structure = @" | |
Alias Document name Parent | |
--------------------------------- | |
root Root DocType -1 | |
textType Text DocType 0 | |
"; | |
var mapped = Regex.Split(structure, @"\r\n", RegexOptions.IgnorePatternWhitespace) /* split string into lines */ |
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.Reflection; | |
public class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// setup db and logger using funcs |
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 Func<string, string> tag(string tag) | |
{ | |
return new Func<string, string>(s => | |
{ | |
return string.Format("<{0}>{1}</{0}>", tag, s); | |
}); | |
} | |
public Func<string, string> tagAttr(string tag, string attrName) | |
{ |
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 object GetCreateAndShipOrder(string userName, string productSku) | |
{ | |
// get product | |
var product = _merchelloContext.Services.ProductService.GetAll().FirstOrDefault(p => p.Sku == productSku); | |
// get customer | |
var customer = _merchelloContext.Services.CustomerService.GetByLoginName(userName); | |
// create customer with fake data if it does not exist already | |
if (customer == null) |
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
function stopvm($azurecloud,$vmname) | |
{ | |
if ($vmname -eq $null) | |
{ | |
Get-AzureVM -ServiceName $azurecloud |Foreach-object {Stop-AzureVM -ServiceName $_.ServiceName -Name $_.Name -Force} | |
} | |
else | |
{ | |
Stop-AzureVM -ServiceName $azurecloud -Name $vmname | |
} |
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
class Greeter { | |
// Hard to see which ones of these are function declarations | |
// and which ones are function calls: | |
greet0() { | |
// do something... | |
} | |
greet1(){ | |
greet2({ | |
// can you spot the difference? |
NewerOlder