Skip to content

Instantly share code, notes, and snippets.

View dwcullop's full-sized avatar
💭
01010011 01101111 01101101 01100101 01110100 01101000 01101001 01101110 01100111

Darrin W. Cullop dwcullop

💭
01010011 01101111 01101101 01100101 01110100 01101000 01101001 01101110 01100111
View GitHub Profile
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@aras-p
aras-p / preprocessor_fun.h
Last active November 20, 2024 02:29
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@eyecatchup
eyecatchup / ascii-binary-converter.js
Last active November 6, 2023 20:03
JavaScript native ASCII to Binary / Binary to ASCII convert functions.
// ABC - a generic, native JS (A)scii(B)inary(C)onverter.
// (c) 2013 Stephan Schmitz <[email protected]>
// License: MIT, http://eyecatchup.mit-license.org
// URL: https://gist.github.com/eyecatchup/6742657
var ABC = {
toAscii: function(bin) {
return bin.replace(/\s*[01]{8}\s*/g, function(bin) {
return String.fromCharCode(parseInt(bin, 2))
})
},
@rxaviers
rxaviers / gist:7360908
Last active November 20, 2024 12:51
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@9to5IT
9to5IT / PS_Script_Template_V2_Logs.ps1
Last active August 28, 2024 07:25
PowerShell: Script Template Version 2 (with logging)
#requires -version 4
<#
.SYNOPSIS
<Overview of script>
.DESCRIPTION
<Brief description of script>
.PARAMETER <Parameter_Name>
<Brief description of parameter input required. Repeat this attribute if required>
@bbolli
bbolli / win32_error_category.cpp
Created January 27, 2017 14:54
A C++11 std::error_category for Win32 and Winsock error codes
#include <system_error>
#include <windows.h>
/// Wrap the Win32 error code so we have a distinct type.
struct win32_error_code
{
explicit win32_error_code(DWORD e) noexcept : error(e) {}
DWORD error;
};
@kennykerr
kennykerr / IMemoryBufferByteAccess.cpp
Last active September 13, 2022 04:54
How to use IMemoryBufferByteAccess with C++/WinRT
#include "winrt/Windows.Foundation.h"
struct __declspec(uuid("5b0d3235-4dba-4d44-865e-8f1d0e4fd04d")) __declspec(novtable) IMemoryBufferByteAccess : ::IUnknown
{
virtual HRESULT __stdcall GetBuffer(uint8_t** value, uint32_t* capacity) = 0;
};
using namespace winrt;
using namespace Windows::Foundation;
@AlexBAV
AlexBAV / guid.h
Last active August 10, 2024 06:24
Constexpr GUID parsing (parsing string GUIDs at compile-time)
//-------------------------------------------------------------------------------------------------------
// constexpr GUID parsing
// Written by Alexander Bessonov
//
// Licensed under the MIT license.
//-------------------------------------------------------------------------------------------------------
#pragma once
#include <stdexcept>
#include <string>
#include <Unknwn.h>
#include <winrt/Windows.Foundation.h>
using namespace winrt;
using namespace Windows::Foundation;
struct Stringable : implements<Stringable, IStringable>
{
hstring ToString()
{