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
var wrapperId = 'sidebarWrapperIdOnPage'; | |
var | |
$w = $(window), | |
$wrap = $('#'+wrapperId), | |
followerInitialOffset = $wrap.offset().top, | |
marginTop = 0, | |
$wrap, windowTop, windowBottom, followerHeight, | |
followerTop, followerBottom, followerBottomPosition | |
; |
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
var | |
is_chrome = navigator.userAgent.indexOf('Chrome') > -1, | |
is_safari = navigator.userAgent.indexOf("Safari") > -1 && !is_chrome, | |
is_firefox = navigator.userAgent.indexOf('Firefox') > -1, | |
is_explorer = (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0), | |
is_opera = navigator.userAgent.indexOf("Presto") > -1 | |
; |
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
var selectionIsRTL = function(sel) { | |
sel = sel || document.getSelection(); | |
position = sel.anchorNode.compareDocumentPosition(sel.focusNode); | |
return ( | |
// nodes are same if position === 0 | |
// selection direction is RTL if anchorOffset > focusOffset | |
!position && sel.anchorOffset > sel.focusOffset || | |
// focus preceeds anchor | |
position === Node.DOCUMENT_POSITION_PRECEDING | |
) |
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
/* | |
Synchsafe integers are used in ID3 tags | |
http://id3.org/id3v2.4.0-structure (6.2) | |
https://en.wikipedia.org/wiki/Synchsafe | |
The why of synchsafe: | |
http://stackoverflow.com/a/5652842 | |
Example: | |
255 (%11111111) encoded as a 16 bit synchsafe integer is 383 (%00000001 01111111). |
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
git log -4 | grep 'commit' | awk '{print $2}' | tail -r > commits.txt | |
git co destination_branch | |
for commit in $(cat commits.txt); do git cherry-pick $commit; done | |
git log -4 |
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
# convert all png's in a directory to jpg | |
mogrify -format jpg *.png |
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
# you're in a dark room, it's 2 am, and you're | |
# updating ubuntu via Software Updater, when you get the error: | |
# Not enough free disk space on disk '/boot' | |
# what do you do? try this: | |
# edit: it seems like this one command accomplishes the same thing as the rest, and removes even more unneeded packages | |
audo apt-get autoremove | |
# if that doesn't work for some reason, try the original gist revision's steps: | |
uname -r |
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
#!/bin/bash | |
ext=.png | |
for file in *$ext; do | |
baseName=${file%$ext} | |
baseNoDashes=$(echo $baseName | tr -d '_- .') | |
baseLower=$(echo $baseNoDashes | tr '[:upper:]' '[:lower:]') | |
fileNew=$baseLower$ext | |
echo Renaming $file to $fileNew |
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
#!/bin/bash | |
# if when looking in /var/log/upstart/yourapp.log, you find the error: | |
# Error: /home/yourapp/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/build/Release/bcrypt_lib.node: invalid ELF header | |
# at Error (native) | |
# at Module.load (module.js:355:32) | |
# at Function.Module._load (module.js:310:12) | |
# at Module.require (module.js:365:17) | |
# at require (module.js:384:17) |
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
git push origin :oldname | |
git branch -m oldname newname | |
git push origin newname |
OlderNewer