Skip to content

Instantly share code, notes, and snippets.

@scottalan
scottalan / gist:1022898
Created June 13, 2011 14:49 — forked from glennpratt/gist:1016744
DateTime.php
$ php -a
Interactive shell
php > $date = new DateTime('now');
php > $timestamp = $date->format('U');
php > var_dump($timestamp);
string(10) "1307626589"
php > $timestamp = $date->getTimestamp();
php > var_dump($timestamp);
int(1307626589)
$form['profile-status'] = array(
'#type' => 'radios',
'#title' => '',
'#options' => array(
'new' => t('Create a new profile.'),
'select' => t('Use an existing profile.'),
),
);
$form['select'] = array(
smb.conf -
[global]
workgroup = DEV
server string = %h server (Samba, Ubuntu)
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 10000
syslog = 3
panic action = /usr/share/samba/panic-action %d
@scottalan
scottalan / gist:1663369
Created January 23, 2012 14:20
cat pub key through ssh
ssh [email protected] 'echo '`cat ~/.ssh/id_rsa.pub`' >> ~/.ssh/authorized_keys
$export['addthis_service_customizations'] = $strongarm;
$strongarm = new stdClass;
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'addthis_toolbox_classes';
<<<<<<< HEAD
$strongarm->value = '';
=======
$strongarm->value = 'addthis_32x32_style';
@scottalan
scottalan / gist:1941427
Created February 29, 2012 15:12
blah blah
Rebooting your Linode would not make any changes within your server. Unfortunately, as an unmanaged provider, we wouldn't be intimately familiar with the internal configuration of your Linode, however it appears that "init" is not being found as your disk image is not being mounted correctly. Have you possibly customized your Linode to use XFS as opposed to ext3?
When using Finnix, your Linode's file-system can be found at "/dev/xvda" as per the "Rescue" tab of the Linode Manager. You may want to consider performing a file-system check using "fsck -fy" against your disk image from within Finnix:
http://library.linode.com/troubleshooting/finnix-rescue-mode
Unfortunately, there's no indication of any issues on our end and the problems that you're experiencing appear to be the result of an issue internal to your Linode. If you're unable to identify the cause, your best option may be to re-deploy by backing up any important data from Finnix and creating a new Linode.
Alternatively, you could attempt to resize
php > $timestamp = 1334638800;
php > $date = date('d-m-Y', $timestamp);
php > print $date;
17-04-2012
e.g.,
<?php if ($tabs): ?>
<div class="tabs"><?php print $tabs; ?></div>
<?php endif; ?>
or
<div id="main-content" class="region clear-block">
@scottalan
scottalan / gist:5910787
Created July 2, 2013 16:23
PDOException
WD tmgmt_translator: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'custom_microsoft_translator' [error]
for key 'name': INSERT INTO {tmgmt_translator} (name, label, description, plugin, settings, weight, status, module) VALUES
(:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4,
:db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7); Array
(
[:db_insert_placeholder_0] => custom_microsoft_translator
[:db_insert_placeholder_1] => Custom microsoft translator
[:db_insert_placeholder_2] => Microsoft Translator service.
[:db_insert_placeholder_3] => microsoft
[:db_insert_placeholder_4] =>
@scottalan
scottalan / gist:6237724
Created August 15, 2013 02:32
Install pcre, autoconf, and APC on Mountain Lion.
Taken from: https://gist.github.com/ryanjbonnell/4074061
Modified Versions.
# Compile PCRE - Perl Compatible Regular Expressions
cd /usr/local/src
curl -O ftp://ftp.csx.cam.ac.uk//pub/software/programming/pcre/pcre-8.33.tar.gz
tar -xvzf pcre-8.33.tar.gz
cd pcre-8.33
./configure