I hereby claim:
- I am jsatk on github.
- I am jsatk (https://keybase.io/jsatk) on keybase.
- I have a public key whose fingerprint is 06D4 7A7E FE77 2731 0F67 075A 01BD 80DF DC5A C6E4
To claim this, I am signing this object:
| // [Sieve of Eratosthenes](http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes) | |
| var getPrimes = function (max) { | |
| "use strict"; | |
| var sieve = [], | |
| primes = []; | |
| for (var i = 2; i <= max; i += 1) { | |
| if (!sieve[i]) { | |
| primes.push(i); |
| # JS Lint | |
| # Reference: http://blog.simplytestable.com/installing-jslint-for-command-line-use-on-ubuntu/ | |
| function jslint { | |
| filename=${1##*/} # Name of file. | |
| dir="/Users/Jesse/Desktop/" # Directory where you want your lint files output. Must be full path. No ~. | |
| path="$dir$filename-lint.js" | |
| /usr/local/bin/node /usr/share/node-jslint/node_modules/jslint/bin/jslint.js "$1" > "$path" | |
| } |
| (function () { | |
| 'use strict'; | |
| var doc = this.document, | |
| i, inputs, input, options, rand; | |
| if (!doc.querySelectorAll) return; | |
| inputs = doc.querySelectorAll('input[list]'); |
| var fuckYouIWantMyShitOnTop = function (idOfElementYouWantOnTop) { | |
| var all = document.getElementsByTagName("*"), | |
| maxZIndex = 9007199254740992, // https://gist.github.com/jsatk/7921133#comment-968150 | |
| i, highestZIndex, currentZIndex, currentEl; | |
| for (i = all.length - 1; i >= 0; i--) { | |
| currentEl = all[i]; | |
| currentZIndex = Number(currentEl.style.zIndex); | |
| if (isNaN(currentZIndex)) continue; |
| var ArrowJumpTo = function (event, elements) { | |
| var keyCheck, | |
| scrollToElement, | |
| getElementPositions, | |
| getPositionToScrollTo; | |
| keyCheck = function (event, elements) { | |
| if ([38, 40].indexOf(event.keyCode) === -1) return false; | |
| var els = elements || event.data.element; |
| # For Bash Shell | |
| # Fix the shitty OS X Open With menu duplicates | |
| function fixopenwith() { | |
| /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user | |
| killall Finder | |
| echo 'Open With has been rebuilt, Finder will relaunch' | |
| } | |
| # For Fish Shell http://fishshell.com | |
| function fixopenwith --description 'Fix the shitty OS X Open With menu duplicates' |
| #!/usr/bin/ruby | |
| # Save file to a directory in your $PATH. | |
| # Ensure it is executable `chmod a+x clipboard_manipulation.rb`. | |
| # | |
| # Usage `copy some text like this`. | |
| # Then from the commandline run `clipboard_manipulation.rb space underscore`. | |
| # Your clipborad will now contain the text `copy_some_text_like_this`. | |
| # | |
| # This is a simply and silly script that scratched an itch I was having. |
| { | |
| "always_show_minimap_viewport": true, | |
| "auto_complete_commit_on_tab": true, | |
| "caret_style": "phase", | |
| "draw_minimap_border": true, | |
| "ensure_newline_at_eof_on_save": true, | |
| "highlight_line": true, | |
| "ignored_packages": | |
| [ | |
| "Vintage", |
I hereby claim:
To claim this, I am signing this object:
| var uniqueCharsInStringCounter = function (string) { | |
| var countOfChars = {}, numberCountAndUniqueChars = '', chars, uniqueChars; | |
| if (!string || typeof string !== 'string') { | |
| throw new Error('Must call method with a string as an argument.'); | |
| } | |
| chars = string.split('').sort(); | |
| uniqueChars = chars.filter(function (char, index, array) { | |
| return array.indexOf(char) === index; |