Skip to content

Instantly share code, notes, and snippets.

@aliciaduffy
aliciaduffy / Responsive-Email-Gap
Created October 29, 2012 18:11
Fix for Responsive Email gap on the right side in Iphone Mail
<!-- Add min-width: 100%; to body CSS -->
body {
min-width: 100%;
}
<!-- Add 'style="text-align: center;"' and 'align="center"' to wrapper table -->
<table id="wrapper" width="100%" height="100%" style="width: 100%; height: 100%; margin: 0 !important; text-align:center" border="0" cellspacing="0" cellpadding="0" bgcolor="#eaeff2" align="center">
<tbody>
<tr>
<td align="center">
@ninjascribble
ninjascribble / flatten-array.js
Last active September 23, 2018 15:32
Quick 'n dirty JavaScript interview question #1
/**
* Given an array of n length, where each item in the array may be a letter,
* number or another array, write a function that will return a flattened
* array containing all the values in the original array and its children.
*
* Ex.
*
* var arr = [ 1, 'b', [ 'c', [ 4 ], 5], 'f'];
* flatten(arr) === [1, 'b', 'c', 4, 5, 'f'];
*/
@wch
wch / mynamespace.js
Last active March 28, 2021 14:07
Namespace example in Javascript. This also demonstrates the module pattern.
// mynamespace is an object to use as a namespace
mynamespace = (function() {
// Variables in the namespace
var mynamespace = {
foo: "Yes, this is foo."
};
// "Public" methods for the namespace
mynamespace.fooTwo = function() {
@Integralist
Integralist / RTL.md
Created November 1, 2013 18:42
BBC News' RTL (right to left) solution

Right-to-Left (RTL)

Implementation

There are two methods to use in order to flip CSS styles: interpolated properties and the flip() function.

  • Interpolation should be used for any property which has a direction (e.g. padding-left, margin-right, border-right, left, etc.)
  • flip() should be used for all other properties

Which properties need to be flipped?

@kevin-smets
kevin-smets / iterm2-solarized.md
Last active July 28, 2024 22:14
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@paulallies
paulallies / gist:0052fab554b14bbfa3ef
Last active July 28, 2024 21:16
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin <branch-name>
@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active July 16, 2024 17:25
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@linhmtran168
linhmtran168 / pre-commit-eslint
Last active June 20, 2024 23:01
Pre-commit hook to check for Javascript using ESLint
#!/bin/sh
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$")
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
fi
PASS=true
@Integralist
Integralist / flatten-array.js
Created May 20, 2015 08:35
Array flatten function written in ES6 syntax
const flattenTco = ([first, ...rest], accumulator) =>
(first === undefined)
? accumulator
: (Array.isArray(first))
? flattenTco([...first, ...rest])
: flattenTco(rest, accumulator.concat(first))
const flatten = (n) => flattenTco(n, []);
console.log(flatten([[1,[2,[[3]]]],4,[5,[[[6]]]]]))