Skip to content

Instantly share code, notes, and snippets.

View gormus's full-sized avatar
💭
Never be cruel, never be cowardly.

Osman Gormus gormus

💭
Never be cruel, never be cowardly.
View GitHub Profile
@gormus
gormus / external_links.js
Created September 12, 2010 04:27
Open all the external and PDF links in a new window, with exceptions.
@gormus
gormus / template.php
Created September 12, 2010 04:39
Drupal 6 template.php theme_search_theme_form(), theme_search_block_form()
<?php
/**
* Implements theme_search_theme_form()
*/
function p6_search_theme_form($form) {
$form['search_theme_form']['#title'] = t('Search this site');
$form['search_theme_form']['#default_value'] = '';
$form['search_theme_form']['#attributes']['title'] = t('Enter the terms you wish to search for.');
$form['search_theme_form']['#description'] = t('Enter the terms you wish to search for.');
@gormus
gormus / settings.php
Created September 12, 2010 05:21
Drupal 6 (Pressflow): Disable "first-time" message
<?php
/**
* String overrides:
*
* To override specific strings on your site with or without enabling locale
* module, add an entry to this list. This functionality allows you to change
* a small number of your site's default English language interface strings.
*
<?php
/**
* Disable access to 'Permissions' page.
*
* Even the role has 'administer permissions' enabled, users will not be able to
* access to 'Permissions' page, but be able to use all other functionality
* this permission grants them. i.e. (de-)assigning roles to selected users.
*/
function hook_menu_alter(&$items) {
global $user;
@gormus
gormus / sitemap.css
Created April 5, 2012 20:47
A generic CSS for styling sitemap menu links created by menu block module.
/* Sitemap */
#ui-content .ui-block-menu_block {
font-size: 13px;
}
#ui-content .ui-block-menu_block ul {
line-height: 1;
margin: 0;
float: left;
padding: 0;
}
@gormus
gormus / gist:3020361
Created June 29, 2012 20:12
Drupal 7 - adding new view modes
<?php
/**
* Implements hook_entity_info_alter().
*/
function MYMODULE_entity_info_alter(&$info) {
$info['node']['view_modes'] += array(
'node_feature' => array(
'label' => t('Featured'),
'custom settings' => TRUE,
),
@gormus
gormus / window-size.js
Created July 22, 2012 05:12
Appends an info box to body for displaying the window size. Box content is refreshed by the window resize.
$(document).ready(function () {
$('<div id="WINDOW_SIZE">' + $(window).width() + 'x' + $(window).height() + '</div>')
.attr('unselectable', 'on')
.css({
'position' : 'fixed',
'bottom' : 0,
'right' : 0,
'background' : '#000000',
'color' : '#FFFFFF',
'font' : '16px/1 sans-serif',
@gormus
gormus / 404.html
Created July 31, 2012 03:07
404 - Page not found
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>404 - Page not found!</title>
<style>
html, body {
background: #222;
color: #EEE;
@gormus
gormus / _custom_simple_mail.php
Created October 16, 2012 20:19 — forked from baisong/_custom_simple_mail.php
Drupal 7 function to send simple email to developer or administrator.
<?php
/**
* Sends a simple email.
* [or] Tested on 2012-05-31 using Drupal 7.12
*
* Usage:
* 1) Paste all the below code into your module or include
* 2) Configure the two @FIXME's.
* 3) Visit /_custom_simple_mail to get an email.
*
@gormus
gormus / gist:5827011
Created June 20, 2013 21:49
Load JavaScript Asynchronously. Usage: _async('//example.com/script.js', 'dom-id'); Taken from Twitter and Facebook widget loader scripts and altered a little bit. :-P
/**
* Load JavaScript Asynchronously
*
* usage: _async('//example.com/script.js', 'dom-id');
*/
function _async(src, id) {
setTimeout(
function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {