Skip to content

Instantly share code, notes, and snippets.

View rveitch's full-sized avatar

Ryan Veitch rveitch

View GitHub Profile
@hubgit
hubgit / ElasticSearch.php
Created February 16, 2010 17:20
ElasticSearch class for PHP
<?php
// http://www.elasticsearch.com/docs/elasticsearch/rest_api/
class ElasticSearch {
public $index;
function __construct($server = 'http://localhost:9200'){
$this->server = $server;
}
@freekrai
freekrai / multisite_functions.php
Created July 19, 2011 14:20
Some handy wordpress multisite functions
<?php
$posts = multisite_latest_post( array(
"how_many"=>10,
"how_long_days"=>30,
"how_many_words"=>50,
"more_text"=>"[...]",
"remove_html"=>true,
"sort_by"=>"post_date",
// if paginating:
"paginate"=>true,
@yannisdran
yannisdran / jetpack-localhost-hack
Last active December 11, 2015 20:09
A hack for being able to run Jetpack in WP locally.
# Go to plugins/jetpack/jetpack.php into the folder of your WP local website.
# Find the line (276) below:
/**
* Is Jetpack active?
*/
public static function is_active() {
return (bool) Jetpack_Data::get_access_token( JETPACK_MASTER_USER );
}
@pascalduez
pascalduez / SassMeister-input.scss
Last active February 15, 2025 07:07
Some Sass string functions: capitalize, ucwords, camelize, ...
// ----
// Sass (v3.3.4)
// Compass (v1.0.0.alpha.18)
// ----
// Capitalize string
// --------------------------------------------------------------------------------
// @param [string] $string
// --------------------------------------------------------------------------------
// @return [string]
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@duogeekdev
duogeekdev / hide-admin-bar-in-wordpress.php
Created February 26, 2015 13:33
Hide admin bar in WordPress
<?php
// Simple way
add_filter( 'show_admin_bar', '__return_false' );
// Standard way
add_filter( 'show_admin_bar', 'show_admin_bar_cb' );
function show_admin_bar_cb() {
return false;
}
@acusti
acusti / install.sh
Last active May 3, 2022 03:39
WordPress install script using WP-CLI: supports Multisite, MAMP, local php.ini overrides, and theme and plugin scaffolding, and will generate optimized .gitignore and .htaccess files.
#!/bin/bash
# Install WordPress
# =================
# Based on many sources, but originally based on:
# @ http://premium.wpmudev.org/blog/set-up-wordpress-like-a-pro/
# See also: http://wprealm.com/blog/wordpress-wp-cli-kung-fu-made-simple/
# BEGIN Configuration
@mattjohnsonpint
mattjohnsonpint / moment-tz-guess.md
Created September 29, 2015 22:55
Testing moment-timezone guess feature
Windows Display Name Windows ID Preferred Response Moment Guess Result January Offset July Offset Notes
(UTC-12:00) International Date Line West Dateline Standard Time Etc/GMT+12 Etc/GMT+12 Match -12:00 -12:00
(UTC-11:00) Coordinated Universal Time-11 UTC-11 Etc/GMT+11 Pacific/Pago_Pago Acceptable -11:00 -11:00
(UTC-10:00) Hawaii Hawaiian Standard Time Pacific/Honolulu Pacific/Honolulu Match -10:00 -10:00
(UTC-09:00) Alaska Alaskan Standard Time America/Anchorage America/Anchorage Match -09:00 -08:00
@rveitch
rveitch / sass-7-1-pattern.scss
Last active February 12, 2025 19:56
Sass 7-1 Pattern
sass/
|
|– base/
| |– _reset.scss # Reset/normalize
| |– _typography.scss # Typography rules
| ... # Etc…
|
|– components/
| |– _buttons.scss # Buttons
| |– _carousel.scss # Carousel
@bmcbride
bmcbride / google-form-to-github-issue.md
Last active September 11, 2024 08:13
Create a new GitHub Issue from a Google Form submission

Wiring up a Google Form to GitHub is not that difficult with a little bit of Apps Script automation. All you need is a Google account, a GitHub account, and a web browser...

Set up your GitHub Personal Access Token

Personal access tokens provide an easy way to interact with the GitHub API without having to mess with OAuth. If you don't already have a personal access token with repo or public_repo access, visit your GitHub settings page and generate a new token.

Be sure to copy your token some place safe and keep it secure. Once generated, you will not be able to view or copy the token again.

Set up the Form & Spreadsheet

  1. Create a Google Form.