Skip to content

Instantly share code, notes, and snippets.

@cdnsteve
cdnsteve / boots_and_cats.py
Created Dec 20, 2019
Python boots and cats text to audio - works offline!
View boots_and_cats.py
import pyttsx3
engine = pyttsx3.init()
rate = engine.getProperty('rate')
first_saying = 'And now for: boots and cats'
repeat_saying = 'and boots and cats '
engine.say(first_saying)
engine.setProperty('rate', 360)
View docker_commands.md
@cdnsteve
cdnsteve / fizzbuzz.go
Created Apr 12, 2015
Fizz Buzz example using Go Lang
View fizzbuzz.go
// 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 / install_postgre.sh
Last active Aug 29, 2015
Ruby Python and Postgre install
View install_postgre.sh
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 / drush_command
Created Nov 13, 2014
Drush Modules Enabled List
View drush_command
drush pm-list --type=Module --status=enabled
@cdnsteve
cdnsteve / github_improvements.md
Created Sep 17, 2014
Github Improvements for Devs
View github_improvements.md

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.
View TddTests.php
<?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';
View .travis.yml
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
View jquery_rollovers.js
/**
* Image RollOver Effect
* ========================================================================
*/
jQuery(".rollover").hover(
function () {
var iconName = jQuery(this).attr("src");
var rollover = iconName.replace( /active/, 'rollover' );
jQuery(this).attr({ src: rollover });
},
@cdnsteve
cdnsteve / number_formatter.php
Created Jan 15, 2014
PHP Number converter - converts any number format (English, French, Strings, ints) and returns double (float)
View number_formatter.php
<?php
function validateCleanPrice($num) {
$cleanString = preg_replace('/([^0-9\.,])/i', '', $num);
$onlyNumbersString = preg_replace('/([^0-9])/i', '', $num);
$separatorsCountToBeErased = strlen($cleanString) - strlen($onlyNumbersString) - 1;