Skip to content

Instantly share code, notes, and snippets.

View XEngine's full-sized avatar
🍊

Cem Yılmaz XEngine

🍊
View GitHub Profile
@XEngine
XEngine / .zshrc
Last active September 26, 2024 22:00
ZSH Powerlevel9k Config
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/cem/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
#ZSH_THEME="robbyrussell"
@XEngine
XEngine / 1.md
Created May 28, 2018 23:29 — forked from getify/1.md
BetterPromise: a strawman experiment in subclassing Promise and "fixing" a bunch of its awkward/bad parts

Some things that are "better" with this BetterPromise implementation:

  • BetterPromise # unthen(..) / BetterPromise # uncatch(..) / BetterPromise # unfinally(..) allows you to unregister a fulfillment or rejection handler that you previously registered on a promise via then(..) or catch(..), or unregister a resolution handler that you previously registered on a promise via finally(..).

    NOTE: This seems to be the majority use-case for why many like/want "promise cancelation" -- IOW, often what you want is to just stop observing a promise's resolution, not actually forcibly cancel the operation is comes from.

    var p = new BetterPromise(function(res){
       setTimeout(function(){ res(42); },100);
    });
@XEngine
XEngine / 1.md
Created May 28, 2018 23:29 — forked from getify/1.md
BetterPromise: a strawman experiment in subclassing Promise and "fixing" a bunch of its awkward/bad parts

Some things that are "better" with this BetterPromise implementation:

  • BetterPromise # unthen(..) / BetterPromise # uncatch(..) / BetterPromise # unfinally(..) allows you to unregister a fulfillment or rejection handler that you previously registered on a promise via then(..) or catch(..), or unregister a resolution handler that you previously registered on a promise via finally(..).

    NOTE: This seems to be the majority use-case for why many like/want "promise cancelation" -- IOW, often what you want is to just stop observing a promise's resolution, not actually forcibly cancel the operation is comes from.

    var p = new BetterPromise(function(res){
       setTimeout(function(){ res(42); },100);
    });
const path = require('path')
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const WebpackAssetsManifest = require('webpack-assets-manifest');
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const CleanWebpackPlugin = require('clean-webpack-plugin')
const CleanObsoleteChunks = require('webpack-clean-obsolete-chunks');
const devMode = process.env.NODE_ENV !== 'production'
let webpackConfig = {
require('dotenv').config()
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin')
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
const FixStyleOnlyEntriesPlugin = require("webpack-fix-style-only-entries");
const path = require('path');
{
"private": true,
"browserslist": [
"> 1%",
"not dead"
],
"scripts": {
"dev": "npm run watch",
"watch": "cross-env NODE_ENV=development webpack --watch --progress --hide-modules",
"build": "npm run production",
{
"presets": [
["@babel/preset-env", { "useBuiltIns": "usage", "corejs": 3 }]
],
"plugins": [
"@babel/plugin-transform-async-to-generator",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-syntax-dynamic-import"
]
}
.backup: &backup |
& robocopy "$target" "$target-$datetime" /MIR
.publish: &publish |
$array = @("assets", "Views", "bin", "config")
foreach ($element in $array) {
robocopy "./publish/$element" "$target/$element" /E /MIR /IS /IT
}
variables:
variables:
EXE_RELEASE_FOLDER: ''
DEPLOY_FOLDER: 'C:\htdocs\www.test.de'
NUGET_PATH: 'C:\Runner\nuget.exe'
MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
.backup: &backup |
$path = "$target"
$destination = "$target-$datetime.zip"
$exclude = @("marketing","marketing-test","")
public static class RazorProviderExtensions
{
public static string RenderRazorViewToString(this Controller controller, string viewName, object model = null)
{
controller.ViewData.Model = model;
using (var sw = new StringWriter())
{
var viewResult = ViewEngines.Engines.FindPartialView(controller.ControllerContext, viewName);
var viewContext = new ViewContext(controller.ControllerContext, viewResult.View,
controller.ViewData, controller.TempData, sw);