Skip to content

Instantly share code, notes, and snippets.

View srttk's full-sized avatar
🏡
WFH

Sarath srttk

🏡
WFH
View GitHub Profile
@srttk
srttk / LICENCE SUBLIME TEXT
Created February 23, 2019 17:26
Sublime Text 3 Serial key build is 3176
## Sublime Text 3 Serial key build is 3176
> * Added these lines into /etc/hosts
127.0.0.1 www.sublimetext.com
127.0.0.1 license.sublimehq.com
> * Used the license key
----- BEGIN LICENSE -----
@srttk
srttk / Twitter API with Curl
Created February 13, 2018 10:06 — forked from apolloclark/Twitter API with Curl
Twitter API with Curl
# create an account, create an app
# @see https://apps.twitter.com/
# retrieve the access tokens
# @see https://dev.twitter.com/oauth/reference/post/oauth2/token
# create the file ~/twitter_api
nano ~/twitter_api
Authorization: OAuth oauth_consumer_key="XXXXXX", oauth_nonce="11111111", oauth_signature="XXXXXX", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1450728725", oauth_token="99999-XXXXXX", oauth_version="1.0"
@srttk
srttk / App.js
Created July 7, 2017 01:26 — forked from fdidron/App.js
React Router v4 Auth
//Usage
import React from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import Route from './AuthRoute';
import Login from './Login';
import Private from './Private';
export default () =>
<Router>
@srttk
srttk / aspdotnetcore_set_response_headers.cs
Created May 30, 2017 06:14
ASP.net core set response headers
Result.Content.Headers.Add("Content-Disposition", "attachment; filename=" + FileName);
Result.Content.Headers.Add("Access-Control-Expose-Headers", "filename");
Result.Content.Headers.Add("filename", FileName);
@srttk
srttk / angular2_material_select.html
Created May 26, 2017 10:45
Angular 2 Material Select
<md-select class="md-select-custom-style" name="datasourcetype" placeholder="Data Source Type" [(ngModel)]="dataSource.dataSourceTypeId">
<md-option *ngFor="let dsType of dataSourceTypes" [value]="dsType.dataSourceTypeId">{{ dsType.name }}</md-option>
</md-select>
@srttk
srttk / ng-form-validation.html
Created May 25, 2017 06:08
Angular 2 / 4 Form validation
<form #heroForm="ngForm" *ngIf="active" (ngSubmit)="onSubmit()">
<div class="form-group">
<label for="name">Name</label>
<input type="text" id="name" class="form-control"
required minlength="4" maxlength="24"
name="name" [(ngModel)]="hero.name"
#name="ngModel" >
<div *ngIf="name.errors && (name.dirty || name.touched)"
class="alert alert-danger">
<div [hidden]="!name.errors.required">
@srttk
srttk / some.model.ts
Created May 23, 2017 11:43
get set typescript properties
// Format conversions
get _startDate() {
if (this.startDate) {
let d = new Date(this.startDate);
return d.toLocaleDateString();
}
return '';
@srttk
srttk / person.model.ts
Created May 23, 2017 11:31
Type script / ES 2015 class with propery fill method
export class Person {
name : string;
age: number;
fillFromJson(json: any) {
for (var propName in json) {
this[propName] = json[propName]
}
@srttk
srttk / array_chunk.js
Created April 7, 2017 02:54
Array chunk function
/*
chunk array elements
*/
function chunckArray(arr,chunkSize) {
return arr.map( function(e,i){
return i%chunkSize===0 ? arr.slice(i,i+chunkSize) : null;
})
.filter(function(e){ return e; });
@srttk
srttk / function_invocation.js
Created April 3, 2017 13:05 — forked from myshov/function_invocation.js
11 Ways to Invoke a Function
console.log(1);
(_ => console.log(2))();
eval('console.log(3);');
console.log.call(null, 4);
console.log.apply(null, [5]);
new Function('console.log(6)')();
Reflect.apply(console.log, null, [7])
Reflect.construct(function(){console.log(8)}, []);
Function.prototype.apply.call(console.log, null, [9]);
Function.prototype.call.call(console.log, null, 10);