Skip to content

Instantly share code, notes, and snippets.

try { ... }
catch(Exception ex) { ... } // Catch-Log-Forget
currentEvolutionBoard.ForAllCells(
(cell, nextEvolutionBoard) =>
{
// Any live cell with fewer than two live neighbours dies, as if caused by under-population.
if (cell.IsAlive() && cell.AmountOfNeighbours() < 2)
{
nextEvolutionBoard.CopyCellFromTemplate(cell).Dies();
}
// Any live cell with two or three live neighbours lives on to the next generation.
# Request
GET /images/task/1 HTTP/1.1
Host: www.example.org
# Response
HTTP/1.1 200 OK
Content-Type: application/xml;charset=UTF-8
<status xmlns:atom="http://www.w3.org/2005/Atom">
<state>pending</state>
<order xmlns=″http://schemas.restbucks.com″ xmlns:dap=″http://schemas.restbucks.com/dap″>
<dap:link mediaType=″application/vnd.restbucks+xml″ uri=″http://restbucks.com/order/1234″ rel=″http://relations.restbucks.com/cancel″/>
<dap:link mediaType=″application/vnd.restbucks+xml″ uri=″http://restbucks.com/payment/1234″ rel=″http://relations.restbucks.com/payment″/>
<dap:link mediaType=″application/vnd.restbucks+xml″ uri=″http://restbucks.com/order/1234″ rel=″http://relations.restbucks.com/update″/>
<dap:link mediaType=″application/vnd.restbucks+xml″ uri=″http://restbucks.com/order/1234″ rel=″self″/>
<item>
<milk>semi</milk>
<size>large</size>
<drink>cappuccino</drink>
</item>
public class HelloWorldController : ApiController
{
public IEnumerable<string> Get()
{
return new[] { "hello", "world" };
}
// [Route("api/{controller}/{id}")]
// [HttpGet]
public string Get(int id)
{{ range .Params.tags }}
<a href="{{ $baseurl }}tags/{{ . | urlize }}" class="btn btn-default btn-xs" role="button"><small><span class="glyphicon glyphicon-tag" aria-hidden="true"></span> {{ . }}</small></a>
{{ end }}
{{ partial "footer.html" . }}
SELECT * FROM sys.dm_exec_query_memory_grants
SELECT *
FROM sys.dm_os_performance_counters
WHERE [object_name] LIKE '%Memory Manager%'
SELECT sqltext.TEXT,
req.session_id,
req.status,
req.command,
req.cpu_time,
req.total_elapsed_time,
DB_NAME(req.database_id)
FROM sys.dm_exec_requests req
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext
WITH CTE AS(
SELECT [col1], [col2], [col3], [col4], [col5], [col6], [col7],
RN = ROW_NUMBER() OVER(PARTITION BY Col1, Col2, ... ORDER BY OrderColumn)
FROM dbo.Table1
)
DELETE FROM CTE WHERE RN > 1