View ICalendarParser.ts
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
/** | |
* @copyright bartosz.bobin | |
*/ | |
export class ICalendarParser { | |
skipNotStandardKeys = true; | |
parse(text: string) { | |
const lines = text.replace(/\n /g, '').split(/\n/); | |
let obj = {vcalendar: undefined}; |
View example.js
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 xhr = new XMLHttpRequest(); | |
xhr.open('POST', 'nasz-url', true); | |
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); | |
// należy wymusić 'arraybuffer' | |
xhr.responseType = 'arraybuffer'; | |
xhr.onload = onLoad; | |
xhr.send(); | |
function onLoad() { | |
if (this.status !== 200) { |
View example.js
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 xhr = new XMLHttpRequest(); | |
xhr.open('POST', 'nasz-url', true); | |
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); | |
// należy wymusić 'arraybuffer' | |
xhr.responseType = 'arraybuffer'; | |
xhr.onload = onLoad; | |
xhr.send(); | |
function onLoad() { | |
if (this.status === 200) { |
View router-history.ts
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
import IStateService = angular.ui.IStateService; | |
import IRootScopeService = angular.IRootScopeService; | |
import IState = angular.ui.IState; | |
class RouterHistory | |
{ | |
private history : IHistoryEntry[] = []; | |
public add(stateName : string, stateParams : any) : void | |
{ |
View const-enum.ts
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
// TypeScript | |
const enum Beta { X, Y, Z } | |
const A : Beta = Beta.X; | |
// JavaScript | |
var Beta; | |
(function (Beta) { | |
Beta[Beta["X"] = 0] = "X"; | |
Beta[Beta["Y"] = 1] = "Y"; |
View current.ts
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'; | |
// file: route.cfg.ts | |
class RouteConfig | |
{ | |
public static $inject = ['$stateProvider']; | |
public constructor($stateProvider : angular.ui.IStateProvider){ | |
$stateProvider | |
.state("home", { |
View any.ts
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
enum Color { | |
RED, GREEN, BLUE | |
} | |
class MyClass {} | |
var myAny: any; | |
myAny = 'aaa'; | |
myAny = true; | |
myAny = 0.00; | |
myAny = undefined; |
View gist:5f4abad19b298ddbc682
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 test(name: string): any { | |
if ('bart' === name) { | |
return 1929; | |
} | |
return "Hello " + name; | |
} | |
alert(test('Bart')); |