Skip to content

Instantly share code, notes, and snippets.

Avatar
🦑
🦖

SeanJA SeanJA

🦑
🦖
View GitHub Profile
@SeanJA
SeanJA / 1.json
Created Jun 18, 2012
a simple json file migration for the drupal 7 (maybe 6?) migrate module
View 1.json
{
"title": "this is a title",
"content": "this is a body",
"date": "2009-01-01",
"url":"http://oldsite.com/123/test",
"image": "test.jpg",
"id": 1
}
View tables.html
<html>
<head>
<title>
Yo dawg, I heard you like tables
</title>
</head>
<body>
<table>
View php.sublime-build
{
"cmd": ["php", "-f", "$file"],
/* what is this for? */
"file_regex": ".* in (.*?) on line ([0-9]*)",
"selector": "source.php"
}
@SeanJA
SeanJA / gist:2637382
Created May 8, 2012
most useless fucking error ever
View gist:2637382

Thanks a lot exact target for this helpful error:

Unable to generate preview:
A_SCRIPTINGA scripting error has occurred.
An error occurred when attempting to parse HtmlEmailBody content for HTML content.
MemberID: 1234151
JobID: 0
ListID: 123423

Content Begins With: %%[

View dont.rb
#ffs don't do this
for i in 1..10
if i == 1
next #continue
else
#do stuff
end
end
@SeanJA
SeanJA / tweets-to-image.php
Created May 1, 2012
Turn your twitter avatar into your tweets (with the colour and stuff...)
View tweets-to-image.php
<?php
$username = 'seanja';
if (!file_exists('cache')) {
mkdir('cache', $mode = 0777);
}
if (!file_exists('cache')) {
die('couldn\'t make a cache folder, make one yourself called "cache" in the same dir as this file.');
}
@SeanJA
SeanJA / jquery.proxy.js
Created Mar 22, 2012
jquery.proxy.js
View jquery.proxy.js
if(typeof jQuery.proxy === 'undefined'){
jQuery.extend({
proxy : function( fn, proxy, thisObject ) {
if ( arguments.length === 2 ) {
if ( typeof proxy === "string" ) {
thisObject = fn;
fn = thisObject[ proxy ];
proxy = undefined;
} else if ( proxy && !jQuery.isFunction( proxy ) ) {
@SeanJA
SeanJA / JSDebug.php
Created Sep 30, 2011
debugging in the console from php
View JSDebug.php
<?php
/**
* @method void error() error(string $name, mixed $var)
* @method void exception() exception(string $name, mixed $var)
* @method void info() info(string $name, mixed $var)
* @method void log() log(string $name, mixed $var)
* @method void trace() trace(string $name, mixed $var)
* @method void warn() warn(string $name, mixed $var)
@SeanJA
SeanJA / drupal_email_login.php
Created Aug 17, 2011
Allow drupal users to login with their email address as well
View drupal_email_login.php
<?php
//"stolen" and modified from code in login toboggan
/**
* Capture the form stubmit and check the form_id if it matches a login form, then
* it will check it as an email using an extra validation step
* @param array $form The current form (I guess...)
* @param array $form_state The state of the current form (I guess...)
* @param string $form_id The unique identifier for this form
* @see hook_form_alter
@SeanJA
SeanJA / node.module.patch
Created Aug 9, 2011
node.module patch to fix date check
View node.module.patch
--- node.module 2011-08-09 10:36:01.000000000 -0300
+++ node.module 2011-08-09 12:25:13.000000000 -0300
@@ -803,9 +803,10 @@
// are dealing with an anonymous user we set the user ID to 0.
form_set_error('name', t('The username %name does not exist.', array('%name' => $node->name)));
}
-
+ $strtotime = strtotime($node->date);
// Validate the "authored on" field. As of PHP 5.1.0, strtotime returns FALSE instead of -1 upon failure.
- if (!empty($node->date) && strtotime($node->date) <= 0) {