Skip to content

Instantly share code, notes, and snippets.

View IbnSaeed's full-sized avatar

Ibn Saeed IbnSaeed

View GitHub Profile
@dmouse
dmouse / drupal_redis_settings.php
Last active December 16, 2015 12:08
Configuration Drupal 7 + Redis + Predis.
<?php
// ...
define('PREDIS_BASE_PATH', DRUPAL_ROOT . '/sites/all/libraries/predis/lib/');
$conf['redis_client_interface'] = 'Predis';
$conf['cache_backends'][] = 'sites/all/modules/redis/redis.autoload.inc';
@demoive
demoive / slugify.js
Last active February 9, 2025 17:17
Converts a string to a "URL-safe" slug
/**
* Converts a string to a "URL-safe" slug.
* Allows for some customization with two optional parameters:
*
* @param {string} Delimiter used. If not specified, defaults to a dash "-"
* @param {array} Adds to the list of non-alphanumeric characters which
* will be converted to the delimiter. The default list includes:
* ['–', '—', '―', '~', '\\', '/', '|', '+', '\'', '‘', '’', ' ']
*/
if (!String.prototype.slugify) {
@kosmikko
kosmikko / gist:3083602
Created July 10, 2012 14:24
Makefile for compiling frontend assets
# build output dirs
BUILD_DIR = build
JS_BUILD_DIR = $(BUILD_DIR)/js
CSS_BUILD_DIR = $(BUILD_DIR)/css
IMG_BUILD_DIR = $(BUILD_DIR)/img
VENDOR_BUILD_DIR = $(BUILD_DIR)/vendor
TESTS_BUILD_DIR = test/build
# sources
TEMPLATES = $(shell find app -name '*.hbs')
@mrinalwadhwa
mrinalwadhwa / data_url.rb
Created June 20, 2012 04:00
SCSS custom function to insert data uri into style sheets.
require 'base64'
# tools.ietf.org/html/rfc2397
# developer.mozilla.org/en/data_URIs
# "data:" + MIME type + ";base64," + base64-encoded content
def to_data_url(content, content_type)
outuri = 'data:' + content_type + ';base64'
content = Base64.encode64(content).gsub("\n", '')
outuri += ",#{content}"
@tmm1
tmm1 / elitedesktop.md
Created April 9, 2012 08:00
How to pimp your linux

THIS ASSUMES YOU RUN DEBIAN (or ubuntu, mint) AND ARE NOT A SUCKA MC

XDM

sudo aptitude install xdm
sudo echo '/usr/bin/xdm' > /etc/X11/default-display-manager

spectrwm, dmenu

sudo aptitude install dmenu libxtst-dev
git clone git://opensource.conformal.com/spectrwm.git
cd spectrwm/linux

@IbnSaeed
IbnSaeed / Rounded Corners
Created May 31, 2011 09:52
CSS Rounded Corners
.round_corners {
margin-right: 10px;
padding: 10px;
width: 80px;
-moz-border-radius: 35px;
-khtml-border-radius: 35px;
-webkit-border-radius: 35px;
behavior: url('border-radius.htc');/* override for Microsoft Internet Explorer browsers*/
border-radius: 35px;/* override for Microsoft Internet Explorer browsers*/
border: 4px solid #grey;
@tamzinblake
tamzinblake / regex_end_of_string.md
Created May 27, 2011 15:37
Javascript regex grammar quirk

This gist regards some confusion resulting from this StackOverflow question.

Refer to sections 15.5.4.10 and 15.5.4.11 of the spec - page 145ish.

Before any passes, the cursor is at the start of the string:

, " , f , o , o ,   , b , a , r , " ,
^

lastIndex = 0