Skip to content

Instantly share code, notes, and snippets.

View cdmo's full-sized avatar

Charlie Morris cdmo

  • the middle of pennsylvania
  • X @cdmo
View GitHub Profile
.DS_*
._.DS_*
*.sass-cache*
styles/
@cdmo
cdmo / Gruntfile.js
Created February 4, 2015 19:53
for zurb_foundation theme in drupal
module.exports = function(grunt) {
"use strict";
var theme_name = 'f5';
var global_vars = {
theme_name: theme_name,
theme_css: 'css',
theme_scss: 'scss'
}
@cdmo
cdmo / dump.js
Created August 2, 2012 20:33
var dump in js
//credit http://stackoverflow.com/questions/323517/is-there-an-equivalent-for-var-dump-php-in-javascript
function dump(obj) {
var out = '';
for (var i in obj) {
out += i + ": " + obj[i] + "\n";
}
alert(out);
// or, if you wanted to avoid alerts...
/*
* At the end of the settings.php file for drupal add these lines
*/
/**
* settings file routing
*/
if (file_exists(dirname(__FILE__) . '/local.settings.php')) {
include dirname(__FILE__) . '/local.settings.php';
}
@cdmo
cdmo / .zshrc
Last active December 15, 2015 08:49
a basic starter zsh profile
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
#Environment Variables
export PATH="/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:/opt:$HOME/bin:$HOME/drush:/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5.3/bin:$PATH"
export EDITOR=vim
# Set name of the theme to load.
ZSH_THEME="robbyrussell"
COMPLETION_WAITING_DOTS="true"
@cdmo
cdmo / Preferences.sublime-settings
Last active December 15, 2015 08:49
My default Sublime prefs
{
"autosave": false,
"color_scheme": "Packages/Color Scheme - Default/Monokai Bright.tmTheme",
"default_line_ending": "unix",
"ensure_newline_at_eof_on_save": true,
"fallback_encoding": "UTF-8",
"file_exclude_patterns":
[
".DS_Store"
],
@cdmo
cdmo / log_to_file.php
Last active December 15, 2015 08:49
logging object/array/variable dumps to a file in PHP
<?php
function log_to_file($text) {
$f = fopen('/tmp/my_log.txt', 'a');
fwrite($f, date('Ymd H:i:s - ') . $text . "\n");
fclose($f);
}
// to print arrays/objects use
// log_to_file(print_r($obj, $return = TRUE));
@cdmo
cdmo / handy.md
Last active December 15, 2015 08:49
random stuff that I tend to forget, but need desperately

##Drupal

cache busting in Drupal

drupal_flush_all_caches()
drupal_clear_css_cache()
drupal_clear_js_cache()

getting the full URI of an image

{
"folders":
[
{
"path": "/home/<USER>/workspace/<PROJECT>",
"name": "root",
"file_exclude_patterns": [
".sasscache", "*.css"
]
},
@cdmo
cdmo / get_nodes_statuses.php
Created April 18, 2013 21:27
To discover information about the nodes in a given type. Something I'm cooking up to keep a better eye on important things in Drupal.
<?php
/**
* To discover information about the nodes in a given type
* @param $type a string, choose a content type machine name
* @return a string
*/
function get_nodes_statuses($type) {
$result = db_query('SELECT n.nid, n.title, n.changed FROM {node} n WHERE n.type = :type', array(':type' => $type));
$i = 0;
if ($result) {