Skip to content

Instantly share code, notes, and snippets.

View mouadcherkaoui's full-sized avatar
🎯
Focusing

Mouad Cherkaoui mouadcherkaoui

🎯
Focusing
View GitHub Profile
@emptyother
emptyother / Guid.ts
Last active July 4, 2023 21:00
GUID class for Typescript
class Guid {
public static newGuid(): Guid {
return new Guid(crypto.randomUUID());
// Old IE supported way:
/*return new Guid('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
const r = Math.random() * 16 | 0;
const v = (c == 'x') ? r : (r & 0x3 | 0x8);
return v.toString(16);
}));*/
@nikonthethird
nikonthethird / Snake.ps1
Last active April 18, 2024 00:19
PowerShell script for playing Snake.
#Requires -Version 5.1
Using Assembly PresentationCore
Using Assembly PresentationFramework
Using Namespace System.Collections.Generic
Using Namespace System.ComponentModel
Using Namespace System.Linq
Using Namespace System.Reflection
Using Namespace System.Text
Using Namespace System.Windows
Using Namespace System.Windows.Input
@benjamincharity
benjamincharity / CreateGuid.ts
Created August 10, 2017 12:15
A TypeScript class that generates a guid
// http://stackoverflow.com/questions/26501688/a-typescript-guid-class
class Guid {
static newGuid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
const r = Math.random() * 16 | 0, v = c === 'x' ? r : ( r & 0x3 | 0x8 );
return v.toString(16);
});
}
}
@awright18
awright18 / Sample.fsproj
Last active March 27, 2020 11:24
F# http reqeust with HttpClient
<Project Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="rss.fs" />
@nikhita
nikhita / install-firacode.sh
Created April 24, 2017 17:32
How to install FiraCode font on Linux
mkdir -p ~/.local/share/fonts
for type in Bold Light Medium Regular Retina; do wget -O ~/.local/share/fonts/FiraCode-$type.ttf "https://github.com/tonsky/FiraCode/blob/master/distr/ttf/FiraCode-$type.ttf?raw=true"; done
fc-cache -f
@craigvantonder
craigvantonder / electron-sqlite3.md
Last active October 16, 2022 05:47
Electron SQLite3 Integration

Electron SQLite3 Integration

When trying to use the node-sqlite3 module in Electron I got the error:

Error: Cannot find module '/path/to/my/application/node_modules/sqlite3/lib/binding/electron-v1.4-linux-x64/node_sqlite3.node'

Using Ubuntu 16.04 with Node 7.1.0 and Electron 1.4.12.

I read the following:

@Fireforge
Fireforge / push_replace.ps1
Last active October 25, 2019 18:59
Nuget Package push Powershell script with debug/release specific files
#
# push_replace.ps1
#
# This script is designed to produce customized release and debug nupkgs from a Visual Studio C# project. This is especially useful
# for nupkgs that include native DLLs that are different depending upon debug or release mode.
#
# How to use:
# In your .nuspec file in the <files> section, add the following line:
# <file src="$filelist$" target="lib\native" />
# That line is set to go to lib\native because this script was made for handling native DLLs, but that target can be anything.
@nicholasdille
nicholasdille / Show-JobProgress.ps1
Last active December 30, 2021 20:38
Retrieve progress from PowerShell job and display progress bar
function Show-JobProgress {
[CmdletBinding()]
param(
[Parameter(Mandatory,ValueFromPipeline)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.Job[]]
$Job
,
[Parameter()]
[ValidateNotNullOrEmpty()]
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 14, 2024 03:21
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@davidhagg
davidhagg / WPF Visual Geometry Border Inside
Created May 5, 2015 04:50
WPF Create Visual with border that appears to be only inside of drawn geometry
private static DrawingVisual CreateVisual()
{
var noBorderPen = new Pen(new SolidColorBrush(Colors.Transparent), 0);
var selectionPen = new Pen(new SolidColorBrush(Colors.Yellow), 20 * 2);
var drawingVisual = new DrawingVisual();
using (var dc = drawingVisual.RenderOpen())
{
StreamGeometry geometry = new StreamGeometry();