Skip to content

Instantly share code, notes, and snippets.

@CodeAngry
CodeAngry / CookieMonster.js
Last active Aug 29, 2015
Cookie Monster is a simple JS cookie manager.
View CookieMonster.js
/**
* CookieMonster.JS
*
* @copyright Claude Adrian, CodeAngry
* @license http://www.wtfpl.net/
*/
;(function(){
if (typeof String.prototype.trimLeft !== 'function') {
String.prototype.trimLeft = function() {
@CodeAngry
CodeAngry / CPU_Maker_Model.cpp
Last active Aug 29, 2015
Get CPU Maker and Model.
View CPU_Maker_Model.cpp
//
// Written and Tested in VC++ (C++11 code)
// by @CodeAngry
//
// get the maker name
int vCpuBuffer[4]{};
__cpuid(vCpuBuffer, 0);
unsigned int vHighestFeature((unsigned int)vCpuBuffer[0]);
char vCpuMaker[32]{}; // zero-fill
View HttpSeoRedirect.php
<?php
/**
* The right way to do a SEO HTTP Redirection. (says me)
*
* @copyright Claude "CodeAngry" Adrian
* @link http://codeangry.com/
* @license WTFPL
*/
namespace CA;
@CodeAngry
CodeAngry / get_file_size.cpp
Created Aug 4, 2013
Three methods to get the file size of a path in Windows C++.
View get_file_size.cpp
/// <summary>Values that represent the methods available to get the file size.</summary>
/// <remarks>Claude "CodeAngry" Adrian, 20 May 2012.</remarks>
typedef enum class file_size_methods {
create_file = 1, // CreateFile, GetFileSizeEx, CloseHandle (II speed, I reliable)
get_attributes = 2, // GetFileAttributesEx (I speed)
find_file = 3, // FindFirstFile, FindClose (III speed)
} file_size_method;
/// <summary>Gets athe file size using the chosen method.</summary>
/// <remarks>Claude "CodeAngry" Adrian, 20 May 2012.</remarks>
@CodeAngry
CodeAngry / WpWideAdminMenu.php
Last active Dec 22, 2015
WordPress standalone plugin to make the admin menu wider.
View WpWideAdminMenu.php
<?php
/*
Plugin Name: Wider Admin Menu
Plugin URI: https://github.com/5ubliminal/WordPress-Wider-Admin-Menu
Description: Changes the WordPress admin menu width to <code>apply_filters('admin_menu_width', 200);</code>.
Version: 0.0.7
Author: Claude "CodeAngry" Adrian
Author URI: http://codeangry.com/
License: WTFPL
*/
@CodeAngry
CodeAngry / GetHeadersCUrl.php
Created Oct 4, 2012
Alternative to get_headers with cURL and more bling.
View GetHeadersCUrl.php
<?php
/**
* Does a cURL request against a URL and returns only the Headers.
* If redirections occur, all Headers are returned for each Hop.
*
* By default, if not false, returned value is an array of arrays.
* If $associative is true, each set of Headers will be decoded into an associative array.
* If $only_last is true, regardless of the sets of Headers returned, only the last is kept.
*
* <code>
@CodeAngry
CodeAngry / namespacelessxml.php
Created Aug 18, 2012
Load XML into SimpleXMLElement without Namespaces.
View namespacelessxml.php
<?php
/**
* Loads XML and kills namespaces in the process.
* It allows easy usage of namespaced XML code.
*
* - NameSpaced tags are renamed from <ns:tag to <ns_tag.
* - NameSpaced tags are renamed from </ns:tag> to </ns_tag>.
* - NameSpaced attributes are renamed from ns:tag=... to ns_tag=....
*
* @license http://sam.zoy.org/wtfpl/
@CodeAngry
CodeAngry / sqlpackage_msi.ps1
Created May 29, 2020
Update SQLPackage via Powershell and MSI
View sqlpackage_msi.ps1
# wait before exiting script or force update?
# .\script.ps1 -force 0 -wait 1
param ([bool] $wait = $false, [bool] $force = $false)
$global:ErrorActionPreference = 'SilentlyContinue'
$global:ProgressPreference = 'SilentlyContinue'
Clear-Host
Write-Host "**************************************************************"
@CodeAngry
CodeAngry / PayPalAPI_DoDirectPayment.php
Created Jun 30, 2012
PaypalAPI DoDirectPayment Sale PHP Implementation :: Untested, wrote at anger! :)
View PayPalAPI_DoDirectPayment.php
<?php
// ------------------------------------------------------------------------------------------ //
/**
* LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@CodeAngry
CodeAngry / Verify_PayPal_IPN.php
Last active Dec 17, 2020
Verify PayPal IPN with PHP & cURL. Works for both Live and Sandbox IPNs.
View Verify_PayPal_IPN.php
<?php
/**
* Verifies a PayPal Live/Sandbox IPN.
*
* It returns NULL if freak error occurs (no connection, bad reply, bad IPN).
* It returns BOOL to signal verification success or failure.
*
* @author Claude "CodeAngry" Adrian
*
* @param array/null $IPN