Skip to content

Instantly share code, notes, and snippets.

View SQReder's full-sized avatar
💭
... nihil supernum

Nubami SQReder SQReder

💭
... nihil supernum
  • Rocket Cats
  • Saint Petersburg
View GitHub Profile
@christianhanvey
christianhanvey / modx-snippets.php
Last active June 14, 2023 13:02
Useful snippets for MODX Revo
Snippet: [[SnippetName]]
Chunk: [[$ChunkName]]
System Setting: [[++SettingName]]
TV: [[*fieldName/TvName]]
Link tag: [[~PageId? &paramName=`value`]]
Placeholder: [[+PlaceholderName]]
<?php
@cuppster
cuppster / 1.cs
Created September 3, 2012 18:39
Promises for C# using Generics
/*
modified from original source: https://bitbucket.org/mattkotsenas/c-promises/overview
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Promises
@johnpolacek
johnpolacek / gist:3827270
Last active January 20, 2023 15:46
Prevent FOUC
<!-- Prevent FOUC (flash of unstyled content) - http://johnpolacek.com/2012/10/03/help-prevent-fouc/ -->
<style type="text/css">
.no-fouc {display: none;}
</style>
<script type="text/javascript">
document.documentElement.className = 'no-fouc';
// add to document ready: $('.no-fouc').removeClass('no-fouc');
</script>
@dobrokot
dobrokot / iospeed.cpp
Created March 13, 2013 11:35
Testing speed of ofstream and FILE*
#include <iostream>
#include <fstream>
#include <stdio.h>
const int N = 1000*1000*10;
void f1() {
std::ofstream out("out.txt", std::ios::binary);
for (int i = 0; i < N; ++i) {
@tbarisic
tbarisic / angular2-simple-breadcrumbs.ts
Last active July 24, 2019 14:06
Angular 2 router breadcrumbs example
/*
For each route that you want to appear in breadcrumbs you have to set breadcrumb name in route data as 'breadcrumb' property or in resolve as 'breadcrumb' property.
Import and set breadcrumb component where you want it-->
Route config examples
Route data:
{
path: 'some-path', component: SomeComponent,
data: {
breadcrumb: 'INSERT_BREADCRUMB_NAME'
}
@virolea
virolea / upload.js
Last active June 11, 2024 06:48
Tracking file upload progress using axios
upload(files) {
const config = {
onUploadProgress: function(progressEvent) {
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)
console.log(percentCompleted)
}
}
let data = new FormData()
data.append('file', files[0])
@Den-Rimus
Den-Rimus / ResettableLazyDelegate.kt
Last active June 22, 2022 04:39
Android Kotlin resettable lazy delegate
interface ResettableLazy<out T> : Lazy<T> {
fun reset()
}
private class ResettableSynchronizedLazyImpl<out T>(initializer: () -> T, lock: Any? = null) : ResettableLazy<T> {
private val initializer: (() -> T)? = initializer
@lgg
lgg / solution.md
Last active July 5, 2023 13:41
JetBrains intellij idea + NVM + nodejs + WebStorm

NVM + WebStorm

If you get error:

run npm command gives error "/usr/bin/env: node: No such file or directory

in file watcher

@azinit
azinit / .eslintrc.js
Created May 19, 2021 07:23
imports-linting: order, access
/** Разрешенные импорты (для сортировки) */
const ALLOWED_PATH_GROUPS = ["pages/**", "features/**", "entities/**", "shared/**"].map(
(pattern) => ({
pattern,
group: "internal",
position: "after",
}),
);
/** Для запрета приватных путей */