Skip to content

Instantly share code, notes, and snippets.

View nfreear's full-sized avatar

Nick Freear nfreear

View GitHub Profile
@nfreear
nfreear / my-ajax-debug.drupal.php
Last active September 30, 2015 03:17
If a debug parameter variable is set, output PHP expressions in HTTP headers / Drupal.
<?php
<?php
ini_set( 'display_errors', 1);
error_reporting( E_ALL );
//header( 'Content-Type: text/plain');
function my_test() {
@tpryan
tpryan / ribbon.html
Last active April 11, 2024 00:21
Github Ribbon in CSS.
<!--
Copyright (c) 2012 Terrence Ryan
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following
conditions:
@nfreear
nfreear / iframe-blackout.drupal-block.html
Created January 19, 2012 10:32
Adding SOPA blackout to a Drupal Gardens - Javascript + Iframe - by Jacob Singh.name, Zachstronaut.
<script>
/*!
* Javascript-iframe (Drupal) SOPA-blackout solution.
*
* authors: Jacob Singh, Zachstronaut, Nick Freear, 2012-01-17.
* help: http://jacobsingh.name/content/adding-sopa-blackout-drupal-gardens
* via: http://drupal.org/planet
*/
(function blackout(){
var a = new Date,
@corruptmem
corruptmem / npm-packages.txt
Created December 29, 2011 01:55
NPM packages by "importance"
coffee-script 24019 [u'coffeescript', u'javascript', u'language', u'compiler']
socket.io 19498 [u'websocket', u'socket', u'realtime', u'cross-browser', u'apps', u'ajax', u'socket.io', u'api', u'easy', u'real-time', u'comet']
should 17605 [u'test', u'bdd', u'assert', u'framework']
expresso 16266 [u'tdd']
jade 15322 [u'engine', u'jade', u'template']
stylus 14328 [u'stylesheets', u'style', u'language', u'jade', u'parser', u'css']
mkdirp 13690 [u'directory', u'mkdir', u'like']
mime 13145 [u'util', u'mime', u'mapping', u'library']
underscore 11906 [u'helper', u'programming', u'functional', u'server', u'util', u'client', u'browser']
nodeunit 11571 [u'node.js', u'testing', u'unit', u'easy']
@perusio
perusio / drupal_uid_header.module
Created December 27, 2011 07:31
Simple module to add a header with the user ID
<?php
/**
* @file drupal_uid_header.module
* @author António P. P. Almeida <[email protected]>
* @date Tue Dec 27 2011
*
* @brief Sets an HTTP header with the UID (Drupal 6).
*
*/
@insin
insin / bash_prompt.sh
Created December 3, 2011 01:49 — forked from woods/git_svn_bash_prompt.sh
Set color bash prompt according to active virtualenv, git branch and return status of last command.
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch/status of the current git repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.
@bigdawggi
bigdawggi / Outbound Link Tracking - Google Analytics.js
Created November 22, 2011 23:02
jQuery-based outbound link tracking with cases for new window as well as same window locations
@textarcana
textarcana / git-log2json.sh
Last active January 24, 2025 22:12
Convert Git logs to JSON. The first script (git-log2json.sh) is all you need, the other two files contain only optional bonus features 😀THIS GIST NOW HAS A FULL GIT REPO: https://github.com/context-driven-testing-toolkit/git-log2json
#!/usr/bin/env bash
# Use this one-liner to produce a JSON literal from the Git log:
git log \
--pretty=format:'{%n "commit": "%H",%n "author": "%aN <%aE>",%n "date": "%ad",%n "message": "%f"%n},' \
$@ | \
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \
perl -pe 's/},]/}]/'
@cagatay
cagatay / app.yaml
Created October 18, 2011 19:14 — forked from darktable/app.yaml
App.yaml designed for serving a static site on Google App Engine (Python). Copy your static html and files into a folder called "static" next to app.yaml. Contains a bunch of mimetype declarations from html5boilerplate's .htaccess. May not be necessary
application: your-app-name
version: 1
runtime: python
api_version: 1
default_expiration: "30d"
handlers:
- url: /(.*\.(appcache|manifest))
mime_type: text/cache-manifest
@Munawwar
Munawwar / test.html
Last active January 10, 2017 01:45
IE8 polyfill for HTML5 Range object's startContainer, startOffset, endContainer and endOffset properties.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
/*
This code is a IE8 (and below), polyfill for HTML5 Range object's startContainer,
startOffset, endContainer and endOffset properties.
*/
(function () {
function findTextNode(node, text) {