Skip to content

Instantly share code, notes, and snippets.

View danielbachhuber's full-sized avatar

Daniel Bachhuber danielbachhuber

View GitHub Profile
@westonruter
westonruter / README.md
Last active November 10, 2023 22:24
Google Apps Script for Gmail to automatically forward Google Now notes to self onto Remember the Milk

Google Apps Script for Gmail to automatically forward Google Now notes to self onto Remember The Milk, transforming the transcribed speech into Smart Add syntax, and then archiving the thread in Gmail. Create a new script in Google Drive for Gmail, paste this JS into it, customize the rtm_email variable to your own, and customize the transformations to rtm_task for Smart Add to fit your style, and then set up a trigger to invoke the function every minute. Within approximately a minute after sending yourself a note via Google Now, the reminder will be added to your RTM account!

Example dictation: Note to self to look up article about widgets for work priority 1
Smart Add transformation: Look up article about widgets #work !1

Resources

@emanuelez
emanuelez / git_speed.md
Last active March 17, 2024 19:03
Git Speed

How Fast is Git?

The web is full of benchmarks showing the supernatural speed of Git even with very big repositories, but unfortunately they use the wrong variable. Size is not important, but the number of files in the repository really is!

Why is that? Well, that's because Git works in a very different way compared to Synergy. You don't have to checkout a file in order to edit it; Git will do that for you automatically. But at what price?

The price is that for every Git operation that requires to know which files changed (git status, git commmit, etc etc) an lstat() call will be executed for every single file

Wow! So how does that perform on a fairly large repository? Let's find out! For this example I will use an example project, which has 19384 files in 1326 folders.

@rinatkhaziev
rinatkhaziev / acm_dfp.php
Created January 18, 2012 05:15
ACM DFP Setup
<?php
// Whitelist default double click url
add_filter( 'acm_whitelisted_script_urls', 'rk_acm_whiltelisted_script_urls');
function rk_acm_whiltelisted_script_urls( $whitelisted_urls ) {
$whitelisted_urls = array( 'ad.doubleclick.net' );
return $whitelisted_urls;
}
// Tokenize url
add_filter( 'acm_default_url', 'rk_acm_default_url' ) ;
@rmccue
rmccue / plugin-file.php
Created January 17, 2012 12:27 — forked from kovshenin/plugin-file.php
Improved class concept
<?php
/*****
All new versions will be posted at
https://github.com/rmccue/Rotor_WPPlugin
Please use that repository instead of this Gist.
******/
@mjangda
mjangda / domain-whitelist-check.php
Created January 17, 2012 00:27
Checks if a given url matches a domain whitelist
<?php
function my_is_valid_domain( $url ) {
$whitelisted_domains = array( 'mydomain.com', 'mydomain.net' );
$domain = parse_url( $url, PHP_URL_HOST );
// Check if we match the domain exactly
if ( in_array( $domain, $whitelisted_domains ) )
return true;
$valid = false;
@nickhamze
nickhamze / cpt_contextual_help_starter
Created September 6, 2011 13:01
CPT Contextual Help Starter File
function portfolioposttype_add_help_text($contextual_help, $screen_id, $screen) {
//$contextual_help .= var_dump($screen); // use this to help determine $screen->id
if ('portfolio' == $screen->id ) {
$contextual_help =
'<p>' . __('The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.') . '</p>' .
'<p>' . __('<strong>Title</strong> - Enter a title for your post. After you enter a title, you&#8217;ll see the permalink below, which you can edit.') . '</p>' .
'<p>' . __('<strong>Post editor</strong> - Enter the text for your post. There are two modes of editing: Visual and HTML. Choose the mode by clicking on the appropriate tab. Visual mode gives you a WYSIWYG editor. Click the last ico
@mjangda
mjangda / ajaxurl.php
Created August 18, 2011 22:15
Get a domain-mapping safe admin-ajax URL on WordPress.com
<?php
/**
* Generates a domain-mapping safe URL on WordPress.com
* Core's ajaxurl uses admin_url() which returns *.wordpress.com which doesn't work for the front-end on domain-mapped sites.
* This works around that and generates the correct URL based on context.
*/
function my_admin_ajax_url( $path = '' ) {
if ( is_admin() )
$url = admin_url( 'admin-ajax.php' );
else
@nacin
nacin / p2-resolved-posts.php
Created August 14, 2011 21:24
P2 Resolved Posts
<?php
/* Plugin Name: P2 Resolved Posts
* Description: Allows you to mark P2 posts for resolution.
* Author: Andrew Nacin
* Author URI: http://andrewnacin.com/
*/
/* WARNING about studying and copying this code:
*
* P2 is not currently an ideal platform for developing extensions. Some of this
@mjangda
mjangda / get-functions-for-hook.php
Created August 10, 2011 18:26
Get all the functions registered to a specific WordPress hook
<?php
function debug_get_functions_for_hook( $hook ) {
global $wp_filter;
if( ! isset( $wp_filter[$hook] ) )
return;
$functions = array();
foreach( (array) $wp_filter[$hook] as $key => $actions ) {
//$functions = array_merge( $functions, $actions );
@fcingolani
fcingolani / wp-cron.sh
Created June 14, 2011 19:02
Bash Script to execute wp-cron.php on a Multisite Wordpress.
#!/bin/sh
db_host="host";
db_user="user";
db_pass="password";
db_name="database";
domains=`mysql --silent --skip-column-names --host $db_host --user $db_user -p$db_pass $db_name --execute "SELECT domain FROM wp_blogs WHERE archived = '0' AND spam = '0' AND deleted = '0';"`;
for domain in $domains; do
the_date=`date`;