Skip to content

Instantly share code, notes, and snippets.

language: php
#
# Important to note, this is the version of PHP used to run this build, not the
# one used to run your Drupal installation. Ensure compatibility with the Drush
# and Terminus versions you're using for this build.
#
php:
- 5.3
<?php
// We assume that this script is being executed from the root of the Drupal
// installation. e.g. ~$ `phpunit TddTests sites/all/modules/tdd/TddTests.php`.
// These constants and variables are needed for the bootstrap process.
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
@cdnsteve
cdnsteve / github_improvements.md
Created September 17, 2014 16:29
Github Improvements for Devs

Github Improvements for Devs

Suggestions to make Github better.

  1. /issues need to remember your filters. Changing Milestones every time you view /issues and other flags drives me crazy.
  2. Wiki search. Under the /wiki, the right hand column called Pages lets you search titles. When your wiki grows and grows we need to search content of pages. Great search makes for finding documentation faster.
  3. Wiki content, search as you type for files in codebase so you can easily reference source code. Or even have something like :source filename.ext
  4. Better issue management. For large projects, organizing issues is starting to get too out of control. We have been using Kanban board like Huboard to help prioritize issues. I know others use things like Trello.
@cdnsteve
cdnsteve / drush_command
Created November 13, 2014 19:22
Drush Modules Enabled List
drush pm-list --type=Module --status=enabled
@cdnsteve
cdnsteve / install_postgre.sh
Last active August 29, 2015 14:17
Ruby Python and Postgre install
From http://stackoverflow.com/questions/1383126/django-python-beginner-error-when-executing-python-manage-py-syncdb-psycopg2
Just had to unlink postgreSQL
`brew unlink postgresql`
then
`xcode-select --install`
and finally
`brew install postgresql`
@cdnsteve
cdnsteve / fizzbuzz.go
Created April 12, 2015 18:53
Fizz Buzz example using Go Lang
// Copyright 2015 Steven Leggett. All rights reserved.
package main
import "fmt"
func main() {
const (
x string = "Go Lang Fizz Buzz"
v string = "1.0.0"
@cdnsteve
cdnsteve / facebook_user_likes_page_check.js
Created December 6, 2012 16:57
JavaScript: Facebook check if user likes page
/* Source: http://stackoverflow.com/questions/5093398/how-to-check-if-a-user-likes-my-facebook-page-or-url-using-facebooks-api
*/
function parsePageSignedRequest() {
if (isset($_REQUEST['signed_request'])) {
$encoded_sig = null;
$payload = null;
list($encoded_sig, $payload) = explode('.', $_REQUEST['signed_request'], 2);
$sig = base64_decode(strtr($encoded_sig, '-_', '+/'));
$data = json_decode(base64_decode(strtr($payload, '-_', '+/'), true));
@cdnsteve
cdnsteve / facebook_user_likes_page_check.php
Created December 6, 2012 16:59
PHP: Facebook check if user likes page
<?php
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
$app_data = isset($data["app_data"]) ? $data["app_data"] : '';
$_REQUEST["fb_page_id"] = $data["page"]["id"];
$access_admin = $data["page"]["admin"] == 1;
<?php
// http://www.elasticsearch.com/docs/elasticsearch/rest_api/
class ElasticSearch {
public $index;
function __construct($server = 'http://localhost:9200'){
$this->server = $server;
}
(function() {
var iframes = document.getElementsByTagName('iframe');
for (var i = 0; i < iframes.length; i++) {
var iframe = iframes[i];
var players = /www.youtube.com|player.vimeo.com/;
if(iframe.src.search(players) !== -1) {
var videoRatio = (iframe.height / iframe.width) * 100;
iframe.style.position = 'absolute';