Skip to content

Instantly share code, notes, and snippets.

@rainbat
rainbat / Commit Active Snippet
Last active Nov 3, 2022
This Snippet will be called from the Admin Bar and commit the currently selected snippet to GitHub
View Commit Active Snippet
<?php
function commitsnippet_admin_bar_button($wp_admin_bar){
$args = [
"id" => "custom-button-commitsnippet",
"title" => "Commit Active Snippet",
"href" => "#",
"meta" => [
"class" => "custom-button-class",
"onclick" => "commitSnippet()"
View odbc.php
<?php
/*
-download php (7.4 zip):
https://windows.php.net/download/
unzip in subfolder, rename folder to php:
- rename php.ini-development.ini to php.ini
- uncomment extension dir for windows in php.ini
- enable curl, fileinfo, gd2, mbstring, odbc, openssl extensions by uncommenting in php.ini
@rainbat
rainbat / callhistory.sql
Last active Mar 26, 2018 — forked from madaboutcode/callhistory.sql
Call history, ios, iphone, query
View callhistory.sql
select datetime(date, 'unixepoch') as dd,address,duration/60,id,
case (flags>>15)&1 when 1 then '1' else '0' end || case (flags>>14)&1 when 1 then '1' else '0' end || case (flags>>13)&1 when 1 then '1' else '0' end || case (flags>>12)&1 when 1 then '1' else '0' end || case (flags>>11)&1 when 1 then '1' else '0' end || case (flags>>10)&1 when 1 then '1' else '0' end || case (flags>>9)&1 when 1 then '1' else '0' end || case (flags>>8)&1 when 1 then '1' else '0' end || case (flags>>7)&1 when 1 then '1' else '0' end || case (flags>>6)&1 when 1 then '1' else '0' end || case (flags>>5)&1 when 1 then '1' else '0' end || case (flags>>4)&1 when 1 then '1' else '0' end || case (flags>>3)&1 when 1 then '1' else '0' end || case (flags>>2)&1 when 1 then '1' else '0' end || case (flags>>1)&1 when 1 then '1' else '0' end || case (flags>>0)&1 when 1 then '1' else '0' end flagbin
, flags, answered from call where duration > 0 and face_time_data IS NULL order by dd desc;
@rainbat
rainbat / wordpress-change-url.php
Created Dec 5, 2015 — forked from lavoiesl/wordpress-change-url.php
PHP script to replace site url in Wordpress database dump, even with WPML
View wordpress-change-url.php
#!/usr/bin/env php
<?php
/**
* PHP script to replace site url in Wordpress database dump, even with WPML
* @link https://gist.github.com/lavoiesl/2227920
*/
if (!empty($argv[1]) && $argv[1] == 'update') {
$file = file_get_contents('https://gist.github.com/lavoiesl/2227920/raw/wordpress-change-url.php');
if ($file === false) {