This file contains hidden or 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}; |
This file contains hidden or 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) { |
This file contains hidden or 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) { |
This file contains hidden or 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 | |
{ |
This file contains hidden or 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"; |
This file contains hidden or 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", { |
This file contains hidden or 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; |
This file contains hidden or 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')); |