Skip to content

Instantly share code, notes, and snippets.

@zippy1981
zippy1981 / Get-OleDbProviders.ps1
Created August 23, 2011 10:48
Enumerates through the registry to list OleDb providers.
# Based Loosely on this VB script using a commercial ActiveX object to interrogate the registry.
# http://www.motobit.com/help/regedit/sa117.htm
Get-ChildItem HKLM:\SOFTWARE\Classes\CLSID | ForEach-Object {
$regKey = $_;
if ($regKey.GetValue('OLEDB_SERVICES') -ne $null -and $regKey.OpenSubKey("OLE DB Provider") -ne $null) {
New-Object PSObject -Property @{
'Key' = $regKey.GetValue("");
'OLEDBProvider' = $regKey.OpenSubKey("OLE DB Provider").GetValue("");
};
}
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@jo-snips
jo-snips / events-conditional-wrappers.php
Last active December 21, 2023 12:27
The Events Calendar: Basic Conditional Wrappers
<?php
/*-----------------------------------------------------------------------------------*/
/* Conditional Logic to Detect Various Event Related Views/Pages
/*-----------------------------------------------------------------------------------*/
if( tribe_is_month() && !is_tax() ) { // Month View Page
echo 'were on the month view page';
} elseif( tribe_is_month() && is_tax() ) { // Month View Category Page
@harthur
harthur / snippet.md
Created June 18, 2012 22:12
console.log() key binding for Sublime Text

Go to Sublime Text 2 > Preferences > Key Bindings - User and add this JSON to the file:

[
    { "keys": ["super+shift+l"],
      "command": "insert_snippet",
      "args": {
        "contents": "console.log(${1:}$SELECTION);${0}"
      }
 }
@clinton3141
clinton3141 / functions.php
Created August 23, 2012 11:02
Limit number of words in wordpress post
<?php
// put this is functions.php
define('MAX_POST_WORD_COUNT', 200); // change this to set the maximum word count
add_action('save_post', 'limit_post_word_count'); // run the check whenever a post is created or saved using any method
function limit_post_word_count ($post)
{
if (str_word_count($post->post_content) > MAX_POST_WORD_COUNT)
@sunnyone
sunnyone / ApacheLogParser.psm1
Created December 15, 2012 03:56
Apache Log Parser for PowerShell
function Read-ApacheLog
{
param(
[Parameter(Mandatory=$true)]
[string]
$Path
)
Get-Content -Path $Path | Foreach-Object {
# combined format
@PaulHughes01
PaulHughes01 / functions.php
Last active December 11, 2015 23:39
Workaround to pass a given currency to Eventbrite when using Modern Tribe's The Events Calendar: Eventbrite Tickets plugin.
<?php
/* PLACE THE FOLLOWING IN YOUR THEME'S FUNCTIONS.PHP FILE. */
add_action( 'tribe_eb_after_event_creation', 'my_change_tribe_eventbrite_currency', 10, 4 );
function my_change_tribe_eventbrite_currency( $eventbrite_id, $venue_id, $organizer_id, $post_id ) {
// See http://www.currencysystem.com/codes/ for a list of three-letter
// currency acronyms. Change the below variable to your preference.
$currency_acro = 'EUR';
@9to5IT
9to5IT / Script_Template.ps1
Last active July 10, 2024 09:15
PowerShell: Script Template
#requires -version 2
<#
.SYNOPSIS
<Overview of script>
.DESCRIPTION
<Brief description of script>
.PARAMETER <Parameter_Name>
<Brief description of parameter input required. Repeat this attribute if required>
@X-Y
X-Y / Honeywell_Calibrate.ino
Created June 10, 2014 12:13
Calibrating Arduino Robot compass (old version, Honeywell HMC 6352)
#include <Wire.h>
#define ADDRESS 0x21
void setup(){
Wire.begin();
Serial.begin(9600);
while(!Serial);
calibrate();
}
@ladyada
ladyada / pitftupdater.sh
Last active December 6, 2016 03:25
PiTFT updater scripty
#!/bin/bash
# PiTFT Resistive 2.8" (PID 1601) or Capacitive 2.8" (PID 1983) setup script or Resistive 3.5" (PID 2097) or 2.2" No-Touchscreen setup script!
set -e
function cleanup() {
if [ "${mountpoint}" != "/" ]
then
sudo -n umount "${mountpoint}/boot" 2> /dev/null