Skip to content

Instantly share code, notes, and snippets.

View VelinGeorgiev's full-sized avatar
🏠
Working from home

Velin Georgiev VelinGeorgiev

🏠
Working from home
View GitHub Profile
const fetchRetry = async (url, opts) {
let retryFor = 4
let error = "Something went wrong"
const f = async () => {
try {
const resp = await fetch(url, opts)
return [,resp.json()]
} catch (e) {
return [e]
}
@VelinGeorgiev
VelinGeorgiev / hide-see-all.html
Last active February 25, 2020 22:37
Hide see all on list item ootb web part using script editor
<script>
var maxAttempts = 100;
var currentAttempt = 0;
var hideListElements = function() {
// hide the see all urls
var seeAllUrls = window.document.querySelectorAll("a[data-automation-id='listViewWebPartSeeAll']");
var l = seeAllUrls.length;
while(l--) {
seeAllUrls[l].style.display = 'none';
@VelinGeorgiev
VelinGeorgiev / sharepoint-field-formatting-user-photo-large.json
Created February 3, 2020 17:05
SharePoint field formatter - user large photo
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"children": [
{
"elmType": "div",
"style": {
"width": "128px",
"height": "128px",
"overflow": "hidden",
@VelinGeorgiev
VelinGeorgiev / sharepoint-field-formatting-css-styles.json
Created February 3, 2020 17:04
Add css styles to your SharePoint list field using the column formatter functionality
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"children": [
{
"elmType": "span",
"txtContent": "@currentField",
"style": {
"padding-left": "8px",
"white-space": "nowrap",
@VelinGeorgiev
VelinGeorgiev / sharepoint-field-formatting-image-with-url.json
Created February 3, 2020 17:03
SharePoint column formatting - Image with URL
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"children": [
{
"elmType": "a",
"attributes": {
"href": "https://blog.velingeorgiev.com",
"target": "_blank"
},
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
pool:
vmImage: 'Ubuntu-16.04'
@VelinGeorgiev
VelinGeorgiev / create-projects.sh
Created March 5, 2019 18:09 — forked from waldekmastykarz/create-projects.sh
Bash script to create a set of SharePoint Framework projects
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
#set -o xtrace
version=$1
cmd_base='yo @microsoft/sharepoint --solutionName spfx --component-name HelloWorld --component-description HelloWorld --skip-install'
cmd_v1_1="$cmd_base --no-skip-feature-deployment"
// Use Chrome browser to debug SharePoint Framework React webpart with Visual Studio Code on Windows
// - Install "Debugger for Chrome" extension
// - Add this configuration to the launch.json
// - Close all Chrome browser active instances
// - Start the SPFx nodejs server by executing "gulp serve"
// - Go to VS Code debug view (top menu -> View -> Debug)
// - Hit the play (start debugging) button
// Happy debugging!
// Full guides
// http://blog.velingeorgiev.pro/how-debug-sharepoint-framework-webpart-visual-studio-code
@VelinGeorgiev
VelinGeorgiev / gist:48abb24cb5f471892ae7
Created December 11, 2015 22:00
Golang-MongoDB30-connection-exampl
package main
import (
"fmt"
"time"
"gopkg.in/mgo.v2"
)
//const MongoDb details
@VelinGeorgiev
VelinGeorgiev / dbService.js
Last active December 11, 2015 22:27
angular-indexedDB service
angular.module('app').factory('dbService', [
'$q', function($q) {
return {
init: function() {
var deferred = $q.defer();
var request = indexedDB.open("db");
request.onupgradeneeded = function() {
// The database did not previously exist, so create object stores and indexes.