Skip to content

Instantly share code, notes, and snippets.

Avatar

Denis Molodtsov Zerg00s

View GitHub Profile
@Zerg00s
Zerg00s / Crawl-Sites.ps1
Last active Jun 21, 2020
Crawl Private SharePoint.COM sites
View Crawl-Sites.ps1
$sites = @("IT","HR","FINANCE","ACCOUNTING","PR", 'PM',"B2B","B2C", "MARKETING","OPERATIONS", "LEGAL", "MICROSOFT", "TRAINING", "BD", "SALES", "EXPORT",
"Administration", "Admin", "Production", "Logistics", "Security", "Support", 'Staff', "Branding", 'Production', 'Purchasing',
"RnD", "Network", "Planning", "Dispatch", "Demo", 'Learning', "Education", "Communication", 'Communications', "distribution",
"Management")
$tenantUrl = "https://microsoft.sharepoint.com"
$ManagedPath = "/sites/"
# $ManagedPath = "/teams/"
@Zerg00s
Zerg00s / git logline
Created Jun 20, 2020
git logline pretty print
View git logline
git config --global alias.logline "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
$ git logline
@Zerg00s
Zerg00s / ErrorBoundary.tsx
Created Jun 1, 2020
React Error Boundaries
View ErrorBoundary.tsx
import * as React from "react";
export default class ErrorBoundary extends React.Component<any,
{ hasError: boolean; error: any; errorInfo: any }>{
constructor(props) {
super(props);
this.state = { hasError: false, error: "", errorInfo: "" };
}
public componentDidCatch(error: any, errorInfo: any) {
@Zerg00s
Zerg00s / App_Permissions_deployment.bat
Last active Sep 12, 2019
Register Azure AD App and Upload a certificate
View App_Permissions_deployment.bat
@ECHO OFF
PowerShell.exe -Command "& '%~dpn0.ps1' -path '%~dp0'"
REM PAUSE
@Zerg00s
Zerg00s / install.bat
Last active Dec 22, 2018
setup mocha and chai
View install.bat
$ npm install mocha chai ts-node -g
$ npm install --save-dev mocha chai ts-node @types/chai @types/mocha
Article: https://medium.com/@FizzyInTheHall/run-typescript-mocha-tests-in-visual-studio-code-58e62a173575
@Zerg00s
Zerg00s / .eslintrc
Last active Dec 22, 2018
TSLint setup
View .eslintrc
{
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"rules": {
@Zerg00s
Zerg00s / getFieldNames.js
Created Dec 20, 2018
Get all internal field names using JavaScript
View getFieldNames.js
async function GetFields(listTitle){
let data = await fetch(`${_spPageContextInfo.siteServerRelativeUrl}/_api/web/lists/GetByTitle('Users')/Fields?$filter=Hidden%20eq%20false`,
{
headers: {"Accept":"application/json;odata=verbose"}
});
let fields = await data.json();
console.log(fields.d.results.map(field=>`${field.Title} | ${field.InternalName}\n\r`).join("") );
}
@Zerg00s
Zerg00s / webpack.config.js
Last active Dec 9, 2018
Webpack scss transpiling. minimum
View webpack.config.js
const path = require('path');
const MiniCss = require('mini-css-extract-plugin');
module.exports = (env = {}, argv = {}) => {
const config = {
mode: argv.mode || 'development', // we default to development when no 'mode' arg is passed
// mode: argv.mode || 'production', // we default to development when no 'mode' arg is passed
entry: {
main: path.join(__dirname, 'styles', 'index.scss'),
View I2C scanner
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Wire.h>
void setup()
{
Wire.begin();
Serial.begin(9600);
while (!Serial);
@Zerg00s
Zerg00s / controller.js
Created Nov 14, 2016
Move element inside Angular ng-repeat
View controller.js
// Move list items up or down or swap
$scope.moveItem = function (array, origin, destination) {
var temp = array[destination];
array[destination] = array[origin];
array[origin] = temp;
};
// Move list item Up
$scope.listItemUp = function (itemIndex, array) {
$scope.moveItem(array, itemIndex, itemIndex - 1);
You can’t perform that action at this time.