Skip to content

Instantly share code, notes, and snippets.

View space11's full-sized avatar
🐧

Borys space11

🐧
View GitHub Profile
@space11
space11 / findByExtension.sh
Created September 16, 2019 07:11
Recursively look for files with a specific extension
find $directory -type f -name "*.yaml"
@space11
space11 / propTypes.js
Created September 18, 2019 19:51
React Prop Types cheat sheet.
// PropType for react component
Foo.propTypes = {
component: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
};
// PropType for react children
Bar.propTypes = {
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node,
/*!
* IE10 viewport hack for Surface/desktop Windows 8 bug
* Copyright 2014-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*
* See the Getting Started docs for more information:
* http://getbootstrap.com/getting-started/#support-ie10-width
*/
@space11
space11 / gist:4ab288f34d2a21d635492eccd612abb9
Last active February 26, 2020 20:41 — forked from vekexasia/gist:2328838
Database schema for a password reset functionality.
CREATE TABLE [DataBaseName].[dbo].[PasswordResetTokens] (
[token] varchar(36) NOT NULL, // 36 characters to fit GUID with delimiters
[userId] int NOT NULL,
[lastUpdate] datetime NOT NULL,
[tokenUsed] bit NOT NULL,
CONSTRAINT PasswordResetTokens_PK PRIMARY KEY (token),
CONSTRAINT PasswordResetTokens_FK FOREIGN KEY (userId) REFERENCES [DataBaseName].[dbo].[User](id)
) GO
EXEC [DataBaseName].sys.sp_addextendedproperty 'MS_Description', 'Store Password Reset Tokens ', 'schema', 'dbo', 'table', 'PasswordResetTokens' GO
@space11
space11 / template.html
Created February 26, 2020 20:33
Angular - Expansion Panel - Remove from DOM when closed/minimized
<!--
Demo: https://stackblitz.com/edit/angular-grnnbf?file=app%2Fexpansion-overview-example.html
Credits: Gil-Epshtain @ https://github.com/angular/components/issues/14626#issuecomment-449748528
-->
<mat-accordion>
<mat-expansion-panel *ngFor="let item of list"
(opened)="item.isOpen = true"
(closed)="item.isOpen = false">
<mat-expansion-panel-header>
@space11
space11 / query.cs
Created March 5, 2020 08:09
Entity Framework select from a list of ids obtained from another E.F select query
var listOfIds = db.OrderDetail.Where(n=>n.OrderId == id).Select(x=>x.item_id);
var itemEntity = db.ItemsEntity.Where(m=>listOfIds.Contains(m.item_id));
/*
Credits: https://stackoverflow.com/a/45941739/9336948
*/
@space11
space11 / FormData.cs
Created March 20, 2020 13:12
Read data from FormData
public SomeAction() {
if (Context.Request.ContentLength != null) {
var StartDate = Context.Request.Form["StartMonth"].ToString();
var EndMonth = Context.Request.Form["EndMonth"].ToString();
}
}
@space11
space11 / triggerDownload.js
Created March 26, 2020 08:52
How do I download a file with JavaScript
// https://stackoverflow.com/a/38759207/9336948
// If you don't need to add headers in the request, to download a file in Angular2 you can do a simple:
window.location.href='http://example.com/myuri/report?param=x';
@space11
space11 / EnumAngularTemplate.md
Created April 2, 2020 10:30
Pass Enums in Angular view templates

Create an enum

enum ACTIVE_OPTIONS {
    HOME = 0,
    USERS = 1,
    PLAYERS = 2
}

Create your component, be sure your enum list will have the typeof

@space11
space11 / install_netextender_ubuntu_64_bit
Created May 8, 2020 10:31 — forked from egobude/install_netextender_ubuntu_64_bit
Install NetExtender | Ubuntu 64 Bit
1. go to https://sslvpn.demo.sonicwall.com/cgi-bin/welcome
2. log in with demo/password
3. click on NetExtender icon, this will download a tar.gz with the client
4. sudo ln -s /lib/x86_64-linux-gnu/libssl.so.1.0.0 /usr/lib/libssl.so.6
5. sudo ln -s /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /usr/lib/libcrypto.so.6
6. un-tar the client, make install script executable and launch install