Skip to content

Instantly share code, notes, and snippets.

View derhasi's full-sized avatar
💚
Life is green!

Johannes Haseitl derhasi

💚
Life is green!
  • Nuremberg, Germany
  • 14:22 (UTC +02:00)
View GitHub Profile
@persand
persand / Drupal Pathauto i18n-ascii.txt – extended version
Created July 4, 2010 15:50
Modified i18n-ascii.txt for Drupal Pathauto module
; More thorough than the original. Use this with Pathauto 6.x-1.x.
; Here are the modifications:
; 1. Ü, Ä and Ö characters converted to u, a and o instead of ue, ae and oe.
; 2. Common typographic punctation (dashes, quotation marks and more) added at the bottom.
; global transliteration
[default]
À = "A"
Á = "A"
 = "A"
@wadey
wadey / iterm2.zsh
Last active March 10, 2024 00:32
Change iTerm2 tab color when using SSH
# Usage:
# source iterm2.zsh
# iTerm2 tab color commands
# https://iterm2.com/documentation-escape-codes.html
if [[ -n "$ITERM_SESSION_ID" ]]; then
tab-color() {
echo -ne "\033]6;1;bg;red;brightness;$1\a"
echo -ne "\033]6;1;bg;green;brightness;$2\a"
@ssp
ssp / git-extract-file.markdown
Created January 23, 2012 13:21
Extract a single file from a git repository

How to extract a single file with its history from a git repository

These steps show two less common interactions with git to extract a single file which is inside a subfolder from a git repository. These steps essentially reduce the repository to just the desired files and should performed on a copy of the original repository (1.).

First the repository is reduced to just the subfolder containing the files in question using git filter-branch --subdirectory-filter (2.) which is a useful step by itself if just a subfolder needs to be extracted. This step moves the desired files to the top level of the repository.

Finally all remaining files are listed using git ls, the files to keep are removed from that using grep -v and the resulting list is passed to git rm which is invoked by git filter-branch --index-filter (3.). A bit convoluted but it does the trick.

1. copy the repository to extract the file from and go to the desired branch

// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@emilisto
emilisto / injection-proxy.js
Created May 25, 2012 10:39
A content replacing proxy in node.js
//
// injection-proxy.js
// Emil Stenqvist <emsten@gmail.com>
//
// Free for all!
//
// A content-replacing proxy in node.js.
//
// I made this for debugging JavaScript on a live website.
//
@Anks
Anks / package.json
Created August 20, 2012 08:32
Easy local development with a node.js proxy
{
"name": "your-app-name",
"version": "0.0.1",
"private": true,
"dependencies": {
"http-proxy": "0.8.x",
"connect": "2.3.x"
}
}
@atimb
atimb / find-empty-dir-in-svn.rb
Last active May 10, 2018 22:52 — forked from mfn/find-empty-dir-in-svn.rb
Ruby script to find top-level empty directories in a working SVN directory tree (forked and fixed because original script was not properly working for more complicated directory structure)
##
# Ruby script to find top-level empty directories in a working SVN directory tree
#
# A directory is considered empty, if there are zero files reachable through this directory (excluding
# files under .svn directories). That means that a directory containing other empty directories is
# also empty (recursively). The algorithm will consolidate the output so that it only contains
# top-level empty directories, but not their sub-directories.
#
# The output of this script can be used, for example to remove non-used parts of a SVN repository:
# ruby empty_dirs.rb | xargs svn del
@derhasi
derhasi / drupal_hackedgit.md
Last active December 25, 2021 16:57
Script to get a diff of a Drupal dev project from git and write the diff to the projects folder: `bash check_hacked.sh $PROJECTNAME`.

Check hacked status from git

This small script provides some code to check a project of your installation (located in .../www) against the associated git commit on drupal.org.

Notice: currently the root path and temp directory are hardcoded.

Examples

Check status of views module.

@okunishinishi
okunishinishi / Remove all git tags
Created March 8, 2014 03:12
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@p3t3r67x0
p3t3r67x0 / pseudo_elements.md
Last active January 16, 2024 01:17
A CSS pseudo-element is used to style specified parts of an element. In some cases you can style native HTML controls with vendor specific pseudo-elements. Here you will find an list of cross browser specific pseudo-element selectors.

Styling native elements

Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element or the /deep/ path selector.

video::webkit-media-controls-timeline {
  background-color: lime;
}

video /deep/ input[type=range] {