Skip to content

Instantly share code, notes, and snippets.

@mynameispj
mynameispj / post.html
Created July 12, 2012 22:21
512 Pixels Linked List CSS
<h2 class="entry-title">
<a href="web.html">
The title of an awesome post
<span class="glyph" href="web.html">&raquo;</span>
</a>
</h2>
def explain!
puts 'Want to embed this Gist?'
puts 'Use this: <script src="http://gist.github.com/2059.js"></script>'
end
explain!
@mynameispj
mynameispj / custom-case-2.php
Last active October 7, 2015 02:27
Next / previous node links in Drupal 7
switch($n_node->type) {
case 'your-custom-content-type-machine-name-here':
$html = l('"'.$n_node->title .'"', 'node/'.$n_node->nid, array('html' => TRUE, 'attributes' => array('class' => array('prev-next'), 'title' => $n_node->title)));
return $html;
}
@mynameispj
mynameispj / scrollThatTable.js
Created July 7, 2012 20:58
Scrollable JS table fun time
<script type="text/javascript">
$(window).load(function () {
var isIE = $.browser.msie;
setTimeout(function () {
function sizeTableBrowser() {
$('.rgMasterTable.data').removeClass('data');
$('.rgMasterTable:visible').addClass('data');
var sitewidth = $('.ajax__tab_container:visible').width();
@mynameispj
mynameispj / template.php
Created June 20, 2012 15:30
Drupal 7: add CSS files to certain nodes in template.php
function pj_preprocess_page(&$variables, $hook) {
//ADD TESTICULAR CANCER CSS TO FRONT PAGE
if (drupal_is_front_page()) {
drupal_add_css(drupal_get_path('theme', 'pj') . '/css/tc.css', array('group' => CSS_THEME, 'type' => 'file'));
}
// When this goes through the theme.inc some where it changes _ to - so the tpl name is actually page--type-typename.tpl
if (isset($variables['node'])) {
$variables['theme_hook_suggestions'][] = 'page__type__'. str_replace('_', '--', $variables['node']->type);
@mynameispj
mynameispj / field-swap.js
Created May 15, 2012 20:30
Swap text input for password input on focus / blur
$('input').focus(function() {
if ($(this).hasClass('passwordLabel')) {
$(this).hide();
$(this).next('input').show();
$(this).next('input').focus();
}
if (this.value == this.defaultValue){
this.value = '';
}
@mynameispj
mynameispj / node.tpl.php
Created April 5, 2012 19:45
Drupal 7 - $messages in node.tpl.php
global $global_messages;
print $global_messages;
@mynameispj
mynameispj / hack.sh
Created April 4, 2012 13:32 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@mynameispj
mynameispj / gist:2296224
Created April 3, 2012 23:17
Google Maps API JS
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzaSyAOj_3CRyephdFtCbWh5OZ6eXa49zcJFHM&sensor=false"></script>
<div id="address" style="display:none;"><!--address for the map goes here-->8134 Country Village Drive Cordova, TN 38016</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
var geocoder;
function initialize() {
geocoder = new google.maps.Geocoder();
@mynameispj
mynameispj / gist:2292158
Created April 3, 2012 13:50
JS - force page to reload
window.location.reload(true);