This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CSS | |
# add missing semicolon to last property | |
([^;])$(\n}) | |
$1;$2 | |
# Shorten hex color values | |
#([\da-f])\1([\da-f])\2([\da-f])\3\b | |
#$1$2$3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place your settings in this file to overwrite the default settings | |
{ | |
"editor.tabSize": 2, | |
"editor.insertSpaces": true, | |
"editor.wordWrap": "off", | |
"editor.detectIndentation": false, | |
"files.associations": { | |
"*.css.erb": "css", | |
"*.ejs": "html", | |
"*.pac": "javascript", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete remote branch | |
git push origin :branch-name | |
# Set upstream | |
git branch --set-upstream-to=upstream/branchname | |
# Shorthand for diff of git commit with its parent | |
git diff COMMIT^! | |
# or | |
git diff-tree -p COMMIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Your snippets | |
# | |
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to | |
# expand the prefix into a larger code block with templated values. | |
# | |
# You can create a new snippet in this file by typing "snip" and then hitting | |
# tab. | |
# | |
# An example CoffeeScript snippet to expand log to console.log: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Go to package repo page | |
npm repo $package | |
# Go to package home page | |
npm home $package | |
# List outdated packages | |
npm outdated | |
# Remove extraneous packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# run after updating: source ~/.bashrc | |
# some lazy ls aliases | |
alias ll='ls -alF' | |
alias la='ls -A' | |
alias l='ls -CF' | |
# Alias definitions. | |
# You may want to put all your additions into a separate file like |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/env bash | |
# git hook to run a command after `git pull` if a specified file was changed | |
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`. | |
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
check_run() { | |
echo "$changed_files" | grep --quiet "$1" && eval "$2" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Packages | |
*.xpi | |
*.zip | |
# Logs and databases | |
*.log | |
*.sql | |
*.sqlite | |
# OS generated files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
window.localStorage.setItem('testKey', '1'); | |
window.localStorage.removeItem('testKey'); | |
} | |
catch (error) { | |
window.localStorage = { | |
_data: {}, | |
setItem: function(id, val) { return this._data[id] = String(val); }, | |
getItem: function(id) { return this._data.hasOwnProperty(id) ? this._data[id] : undefined; }, | |
removeItem: function(id) { return delete this._data[id]; }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$filename = 'IMAGE_PATH'; | |
$image = imagecreatefromjpeg($filename); | |
$width = imagesx($image); | |
$height = imagesy($image); | |
$pixel = imagecreatetruecolor(1, 1); | |
imagecopyresampled($pixel, $image, 0, 0, 0, 0, 1, 1, $width, $height); | |
$rgb = imagecolorat($pixel, 0, 0); | |
$color = imagecolorsforindex($pixel, $rgb); | |
?> |