Gabriel Mansour gabrielmansour

View gist:9843631
1 2
// Does not match against already-encoded HTML entities (e.g. &)
/&(?!(?:[a-z0-9]+|#x?[a-z0-9]{1,4});)/i
View gist:8969418
1 2 3 4 5
CONVENT CONNIVANCE CONFUDDLES CONSTABLES:
Considering conspicuous conduct concerning constant congregation confessions, Contra-Conformists confident
Conservative congressmen conversion conspiracy continues, constructing contrived convivial consecrations
connecting controversial contretemps. Consequently, consistent concentrated conflict convulses Connecticut;
Confederates' condos condemned.
View gist:8247479
1 2 3 4 5 6 7 8
var a = [];
for (var i in localStorage){
if (localStorage.propertyIsEnumerable(i) && i.indexOf('dataset_')===0){
a.push( i.split('_')[1] );
}
}
 
$('#container').load([location.path, a.join('|')].join('/'));
View gist:7836276
1 2 3 4
// Convert CamelCase to an under_scored_word
function underscore(s){
return s.replace(/(?!^)([A-Z])/g, function(m){ return '_' + m }).toLowerCase();
}
View gist:7714414
1 2 3 4 5 6 7 8
<?php
static function present($object){
$klass= ucfirst(preg_replace_callback('/_([a-z])/',
function($m) { return strtoupper($m[1]);},
$object->type)). 'Presenter';
return new $klass($object);
}
View drupal_var_fix.php
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env drush
 
# Once it prints the faulty variable names, just re-set the values using `drush vset {variable_name} "{value}"
 
$variables = db_query('SELECT name, value FROM {variable}')->fetchAllKeyed();
 
foreach ($variables as $key => $val) {
$v = unserialize($val);
 
if ($v === FALSE && $val !== 'b:0;') {
View gist:6833135
1 2 3 4 5 6 7 8 9 10
div { font-family: Helvetica, Arial, sans-serif; width: 50%;}
ol li {
list-style-type: none;
counter-increment: li;
margin-bottom: 0.5em;
margin-left: 3em;
}
ol li:before {
content: counter(li);
position: relative;
View css_URIs.js
1 2 3
$.each(document.styleSheets, function() {
this.href ? console.log(this.href) : $.map(this.cssRules, function(import){ console.log(import.href) })
})
View gist:6208002
1 2 3 4 5 6 7 8 9 10
<?php
// EE to WP Export template
// Run at http://site.com/template-location/CHANNEL_NAME/POST_TYPE/CONTENT_FIELD_NAME/FEATURED_IMAGE_FIELD_NAME/OFFSET
// It's important to use a root level template, and restrict access to the admin role
// Set Type to XML, allow PHP, and PHP Parse on Output
$DB = &$this->EE->db;
echo '<' . '?' . 'xml version="1.0" encoding="UTF-8"' . '?' . '>';
?>
View hack sink ship
1 2 3 4 5 6 7 8 9 10
# Variation on Hashrocket's script for managing the git process
# as documented here: http://reinh.com/blog/2008/08/27/hack-and-and-ship.html
# Create shell scripts out of each of these, put them in your path (~/bin for example)
# chmod 755 them and use like this:
#
# This version of hack is totally different than Hackrockets. I feel that hack implies
# that you are getting started, not finishing up. sink is Hashrockets hack.
#
# $ hack branch_name
# Test and Implement until done
Something went wrong with that request. Please try again.