Skip to content

Instantly share code, notes, and snippets.

View woehrl01's full-sized avatar
💡
Learn to be indifferent to what makes no difference.

Lukas Wöhrl woehrl01

💡
Learn to be indifferent to what makes no difference.
View GitHub Profile
@flcdrg
flcdrg / CreateVSTSItems.ps1
Created June 22, 2018 06:28
Migrate Redmine issues to Visual Studio Team Services work items
param(
$user, # "VSTS username - doesn't need @domain suffix"
$token, # VSTS personal access token
$project, # the VSTS project to create items in
$vstsAccountName, # the bit before .visualstudio.com
$csvFile, # path to the .csv file
$redmineIssueUrl # URL to legacy redmine server. eg. https://redmine/issues
)
$ErrorActionPreference = "Stop"
@jarretmoses
jarretmoses / React Native Clear Cache
Last active July 17, 2024 15:14
Clearing the Cache of your React Native Project
RN < 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.63 - watchman watch-del-all && rm -rf node_modules && npm install && rm -rf /tmp/metro-* && npm run start --reset-cache
npm >= 5 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache
Windows - del %appdata%\Temp\react-native-* & cd android & gradlew clean & cd .. & del node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache
@svick
svick / Program.cs
Created March 9, 2015 20:20
C# 6.0 FormattableString on .Net 4.0
using System;
using System.Globalization;
static class Program
{
private static void Main()
{
double d = 3.14;
IFormattable s = $"{d}";
Console.WriteLine(s.ToString(null, CultureInfo.GetCultureInfo("cs-cz")));
/// <summary>
/// Wrapper for GDI text rendering functions<br/>
/// This class is not thread-safe as GDI function should be called from the UI thread.
/// </summary>
/// <remarks>
/// http://theartofdev.com/2013/08/12/using-native-gdi-for-text-rendering-in-c/<br/>
/// The MIT License (MIT) Copyright (c) 2014 Arthur Teplitzki.
/// </remarks>
public sealed class NativeTextRenderer : IDisposable
{
@jgatjens
jgatjens / direcory_tag.rb
Created February 10, 2014 22:03
jekyll-plugin loop_directory
#usage:
#{% loop_directory directory:images iterator:image filter:*.jpg sort:descending %}
# <img src="{{ image }}" />
#{% endloop_directory %}
module Jekyll
class LoopDirectoryTag < Liquid::Block
include Liquid::StandardFilters
Syntax = /(#{Liquid::QuotedFragment}+)?/
@Virtlink
Virtlink / TypeSwitch.cs
Last active March 9, 2019 17:11
Switch on type. The order of the Case() methods is important.
using System;
namespace Virtlink
{
/// <summary>
/// Executes a particular piece of code based on the type of the argument.
/// </summary>
/// <example>
/// Usage example:
/// <code>
@orient-man
orient-man / Fixtures.cs
Created December 19, 2013 13:41
Simplified implementation of xunit's IUseFixture handling for NUnit
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
namespace Piatka.Infrastructure.Tests.Fixtures
{
public interface IUseFixture<T> where T : IDisposable
{
void SetFixture(T data);
public class DatabaseDeleter
{
private readonly ISessionFactory _configuration;
private static readonly string[] _ignoredTables = new[] { "sysdiagrams", "usd_AppliedDatabaseScript" };
private static string[] _tablesToDelete;
private static string _deleteSql;
private static object _lockObj = new object();
private static bool _initialized;
public DatabaseDeleter(ISessionFactory sessionSource)
@marcedwards
marcedwards / high-dpi-media.css
Last active November 19, 2023 12:56
A CSS media query that captures almost all high DPI aware devices.
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs