https://medium.com/@walkert/fun-building-shared-libraries-in-go-639500a6a669
https://www.darkcoding.net/software/building-shared-libraries-in-go-part-2/
| using System; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using System.Globalization; | |
| using System.Linq; | |
| using System.Linq.Expressions; | |
| using System.Text; | |
| using System.Web; | |
| using System.Web.Mvc; |
| function string:contains(sub) | |
| return self:find(sub, 1, true) ~= nil | |
| end | |
| function string:startswith(start) | |
| return self:sub(1, #start) == start | |
| end | |
| function string:endswith(ending) |
This is a compiled list of falsehoods programmers tend to believe about working with time.
Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.
| import { Injectable } from '@angular/core'; | |
| import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor, HttpErrorResponse, HttpResponse } from '@angular/common/http'; | |
| import { Observable } from 'rxjs/Observable'; | |
| import 'rxjs/add/operator/do'; | |
| @Injectable() | |
| export class AngularDateHttpInterceptor implements HttpInterceptor { | |
| // Migrated from AngularJS https://raw.githubusercontent.com/Ins87/angular-date-interceptor/master/src/angular-date-interceptor.js | |
| iso8601 = /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/; |
Based on https://www.gnu.org/software/make/manual/html_node/Quick-Reference.html
| Directive | Description |
|---|---|
define variable define variable = define variable := define variable ::= define variable += define variable ?= endef |
Define multi-line variables. |
undefine variable |
Undefining variables. |
| using System; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using System.Globalization; | |
| using System.Linq; | |
| using System.Linq.Expressions; | |
| using System.Text; | |
| using System.Web; | |
| using System.Web.Mvc; |
| import org.hamcrest.Description; | |
| import org.hamcrest.Factory; | |
| import org.hamcrest.Matcher; | |
| import org.hamcrest.TypeSafeMatcher; | |
| public class CaseInsensitiveSubstringMatcher extends TypeSafeMatcher<String> { | |
| private final String subString; | |
| private CaseInsensitiveSubstringMatcher(final String subString) { |
| // JS array equivalents to C# LINQ methods - by Dan B. | |
| // First: This version using older JavaScript notation for universal browser support (scroll down for ES6 version): | |
| // Here's a simple array of "person" objects | |
| var people = [ | |
| { name: "John", age: 20 }, | |
| { name: "Mary", age: 35 }, | |
| { name: "Arthur", age: 78 }, | |
| { name: "Mike", age: 27 }, |
| let map = new Map(); | |
| map.set("a", 1); | |
| map.set("b", 2); | |
| map.set("c", 3); | |
| let obj = Array.from(map).reduce((obj, [key, value]) => ( | |
| Object.assign(obj, { [key]: value }) // Be careful! Maps can have non-String keys; object literals can't. | |
| ), {}); | |
| console.log(obj); // => { a: 1, b: 2, c: 3 } |