Skip to content

Instantly share code, notes, and snippets.

@josheinstein
josheinstein / Args.cs
Created April 30, 2012 16:21
Argument Validation Helper (C#)
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
/// <summary>
/// Provides methods for checking method arguments for validity and throwing localizable exceptions for invalid
/// arguments or argument combinations.
@pierre3
pierre3 / StringExtensions.t4.cs
Created August 21, 2013 14:28
string to primitive

using System;
using System.Linq;
using System.Text;
using System.Globalization;
namespace TextDataUtility
{
public static partial class StringExtensions
{
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Globalization;
public static partial class StringExtensions
{
public static sbyte ToSByte(this string s)
{
@ssskip
ssskip / ISO3166-1.alpha2.json
Last active May 1, 2024 09:36
json of country codes (ISO 3166-1 alpha-2) and corresponding names
{
"AF": "Afghanistan",
"AX": "Aland Islands",
"AL": "Albania",
"DZ": "Algeria",
"AS": "American Samoa",
"AD": "Andorra",
"AO": "Angola",
"AI": "Anguilla",
"AQ": "Antarctica",
@mul14
mul14 / README.md
Last active February 10, 2023 00:55
Simple Laravel Search Trait

Usage

Put SearchTrait.php in app directory. Then use SearchTrait in your model, like so

use App\SearchTrait;
use Illuminate\Database\Eloquent\Model;

class Article extends Model 
{
@motss
motss / LitElement_mobx.ts
Last active January 14, 2023 21:18
Best of both worlds: lit-element + mobx
import { html, LitElement } from 'https://unpkg.com/lit-element@latest/lit-element.js?module';
import { observable, action, autorun, reaction } from 'https://unpkg.com/mobx@latest/lib/mobx.es6.js?module';
const store = observable({
title: 'Hello, World!',
count: 0,
incrementCount: action(() => {
store.count += 1;
}),
@ScottHutchinson
ScottHutchinson / install-vsix.ps1
Last active May 3, 2024 21:48
PowerShell scripts for batch installing Visual Studio extensions
# Based on http://nuts4.net/post/automated-download-and-installation-of-visual-studio-extensions-via-powershell
param([String] $PackageName)
$ErrorActionPreference = "Stop"
$baseProtocol = "https:"
$baseHostName = "marketplace.visualstudio.com"
$Uri = "$($baseProtocol)//$($baseHostName)/items?itemName=$($PackageName)"
@Dirack
Dirack / nautilusScript.md
Created July 25, 2019 22:36
Como criar um script do nautilus para abrir um terminal na pasta atual da janela aberta do nautilus

Create a script called Terminal (yes, without a extension) inside the folder ~/.local/share/nautilus/scripts with the following content:

#!/bin/sh
gnome-terminal

Make it executable, then close any Nautilus instance:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>HTML inputmode attribute</title>
<style>
* {
padding: 0;
@cereme
cereme / HtmlClipboard.py
Created March 26, 2020 06:33
Copy HTML to clipboard in Windows32
"""
https://stackoverflow.com/a/60024346/6521523
Edit on Jan 02, 2020
@author: the_RR
Adapted for python 3.4+
Requires pywin32
original: http://code.activestate.com/recipes/474121/
# HtmlClipboard
# An interface to the "HTML Format" clipboard data format