Skip to content

Instantly share code, notes, and snippets.

@cdnsteve
cdnsteve / drupal-password-reset.php
Last active December 18, 2015 04:18
Place this in your /root drupal directory. Change NEWPASSHERE to the new password for the root user. run yoursite.com/drupal-password-reset.php Take the output new password hash then go into MySQL and enter it, replacing: PASSWORDHASHOUTPUT This updates the admin user account to the new password.
<?php
/*
* Resets password, copy this into Users table in MySQL
* Drupal 7
*/
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
@cdnsteve
cdnsteve / Drupal 7 Fix for Appfog tmp
Created December 27, 2013 22:21
RE: Drupal Error on Appfog Warning: tempnam(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): Just add this snippet to settings.php without changing core. Flush your cache and then you're good to go!
/**
* Force location of /tmp for Appfog
*/
$conf['file_temporary_path'] = realpath($_SERVER['DOCUMENT_ROOT'].'/../tmp');
/* END */
@cdnsteve
cdnsteve / vagrant_commands
Last active January 2, 2016 12:59
Vagrant Commands
# Checkout https://drupal.org/node/2146223
# And https://github.com/mikebell/drupaldev-nginx
#
##
# cd ~/Vagrant
# vagrant box list
# vagrant init ubuntu12
@cdnsteve
cdnsteve / number_formatter.php
Created January 15, 2014 14:47
PHP Number converter - converts any number format (English, French, Strings, ints) and returns double (float)
<?php
function validateCleanPrice($num) {
$cleanString = preg_replace('/([^0-9\.,])/i', '', $num);
$onlyNumbersString = preg_replace('/([^0-9])/i', '', $num);
$separatorsCountToBeErased = strlen($cleanString) - strlen($onlyNumbersString) - 1;
@cdnsteve
cdnsteve / jquery_rollovers.js
Created January 29, 2014 03:27
jQuery Rollovers
/**
* 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 / docker_commands.md
Last active February 22, 2016 17:37
Docker Commands
@cdnsteve
cdnsteve / boots_and_cats.py
Created December 20, 2019 02:31
Python boots and cats text to audio - works offline!
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)
@cdnsteve
cdnsteve / gist:5396612
Last active April 4, 2020 11:46 — forked from jaredhanson/gist:2559730
Node.js: Restify and Passport for FB
// Based off example code from Hal Robertson
// https://github.com/halrobertson/test-restify-passport-facebook
// See discussion: https://groups.google.com/forum/?fromgroups#!topic/passportjs/zCz0nXB_gao
var restify = require('restify')
// config vars
var FB_LOGIN_PATH = '/api/facebook_login'
var FB_CALLBACK_PATH = '/api/facebook_callback'
var FB_APPID = '<<YOUR APPID HERE>>'