Skip to content

Instantly share code, notes, and snippets.

View othree's full-sized avatar
:accessibility:
On the way to refactoring

othree othree

:accessibility:
On the way to refactoring
View GitHub Profile
diff -r 10a119b05204 src/regexp.c
--- a/src/regexp.c Thu Nov 13 14:26:09 2014 +0100
+++ b/src/regexp.c Sat Nov 15 14:44:06 2014 +0900
@@ -8186,16 +8186,12 @@
char_u *pat = vim_strsave(((nfa_regprog_T *)rmp->regprog)->pattern);
p_re = BACKTRACKING_ENGINE;
- vim_regfree(rmp->regprog);
if (pat != NULL)
{
@danburzo
danburzo / smartypants.js
Last active November 9, 2016 11:04
Smartypants in JavaScript
function smartypants(str) {
/*
Rules adapted from:
http://www.leancrew.com/all-this/2010/11/smart-quotes-in-javascript/
*/
return [
[/(^|[-\u2014\s(\["])'/g, "$1\u2018"], // opening single quote
[/'/g, "\u2019"], // closing single quote, apostrophe
[/(^|[-\u2014/\[(\u2018\s])"/g, "$1\u201c"], // opening double quote
[/"/g, "\u201d"], // closing double quote
@pburtchaell
pburtchaell / styles.css
Last active February 25, 2024 12:24
VH and VW units can cause issues on iOS devices. To overcome this, create media queries that target the width, height, and orientation of iOS devices.
/**
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units
*
* To overcome this, create media queries that target the width, height, and orientation of iOS devices.
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
* the height of element `.foo` —which is a full width and height cover image.
*
* iOS Resolution Quick Reference: http://www.iosres.com/
*/
@adrianorsouza
adrianorsouza / sublime-command-line.md
Last active September 26, 2023 16:26
launch sublime text from the command line

Launch Sublime Text from the command line on OSX

Sublime Text includes a command line tool, subl, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITOR for unix tools, such as git and subversion.

Requirements

  • Sublime text 2 or 3 installed in your system within Applications folder

Setup

@staltz
staltz / introrx.md
Last active March 26, 2024 00:52
The introduction to Reactive Programming you've been missing
@guilherme
guilherme / gist:9604324
Last active February 24, 2024 20:39
Git pre-commit hook that detects if the developer forget to remove all the javascript console.log before commit.
#!/bin/sh
# Redirect output to stderr.
exec 1>&2
# enable user input
exec < /dev/tty
consoleregexp='console.log'
# CHECK
if test $(git diff --cached | grep $consoleregexp | wc -l) != 0
then
@WebReflection
WebReflection / Object.getOwnPropertyDescriptors.md
Created March 4, 2014 19:28
Object.getOwnPropertyDescriptors(O)

Object.getOwnPropertyDescriptors(O)

When the getOwnPropertyDescriptors function is called, the following steps are taken:

  1. Let obj be ToObject(O).
  2. ReturnIfAbrupt(obj).
  3. Let keys be the result of calling the [[OwnPropertyKeys]] internal method of obj.
  4. ReturnIfAbrupt(keys).
  5. Let descriptors be the result of the abstract operation ObjectCreate with the intrinsic object %ObjectPrototype% as its argument.
  6. Let gotAllNames be false.
@namuol
namuol / INSTALL.md
Last active July 24, 2023 11:53
rage-quit support for bash

rage-quit support for bash

HOW TO INSTALL

Put flip somewhere in your $PATH and chmod a+x it.

Copy fuck into ~/.bashrc.

@stefansundin
stefansundin / install-pre-commit.sh
Last active September 17, 2023 11:46
Git pre-commit check to stop accidental commits to master/main/develop branches.
#!/bin/bash
# This gist contains pre-commit hooks to prevent you from commiting bad code or to the wrong branch.
# There are six variants that I have built:
# - pre-commit: stops commits to master/main/develop branches.
# - pre-commit-2: also includes a core.whitespace check.
# - pre-commit-3: the core.whitespace check and an EOF-newline-check.
# - pre-commit-4: only the core.whitespace check.
# - pre-commit-5: elixir formatting check.
# - pre-commit-6: prettier formatting check.
# Set the desired version like this before proceeding:
@larrybotha
larrybotha / A.markdown
Last active February 7, 2024 15:20
Fix SVGs not scaling in IE9, IE10, and IE11

Fix SVG in <img> tags not scaling in IE9, IE10, IE11

IE9, IE10, and IE11 don't properly scale SVG files added with img tags when viewBox, width and height attributes are specified. View this codepen on the different browsers.

Image heights will not scale when the images are inside containers narrower than image widths. This can be resolved in 2 ways.

Use sed in bash to remove width and height attributes in SVG files

As per this answer on Stackoverflow, the issue can be resolved by removing just the width and height attributes.