-
This is a numbered list.
-
I'm going to include a fenced code block as part of this bullet:
Code More Code
Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications
like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.
open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl
You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html
increment = do -> | |
x = 0 | |
-> | |
x++ |
" for use before a colorscheme definition | |
autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red | |
" for use when not using a colorscheme | |
" highlight ExtraWhitespace ctermbg=red guibg=red | |
" show unwanted whitespace | |
match ExtraWhitespace /\s\+\%#\@<!$/ | |
" strip unwanted trailing whitespace on save |
// Using comprehensions | |
function sort(arr) { | |
var pivot, t; | |
if (arr.length === 0) { | |
return []; | |
} | |
[pivot, t] = [arr[0], arr.slice(1)]; | |
return sort([x for (x of t) if x < pivot]) | |
.concat(pivot) | |
.concat(sort([x for (x of t) if x >= pivot])); |
#!/bin/bash | |
BRANCHES=$(git branch -ra | grep $1) | |
NUM=$(echo "$BRANCHES" | wc -l) | |
# check for empty | |
if [ "X$BRANCHES" = "X" ] | |
then | |
echo "No branch matches $1" | |
fi |
The final result: require() any module on npm in your browser console with browserify
This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.
Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5
function createUUID() { | |
return uuid.v4(); | |
} | |
// version 4 | |
// createUUID.regex = '^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$'; | |
createUUID.regex = '^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'; | |
createUUID.is = function (str) { | |
return new RegExp(createUUID.regex).test(str); |
var mediaJSON = { "categories" : [ { "name" : "Movies", | |
"videos" : [ | |
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org", | |
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ], | |
"subtitle" : "By Blender Foundation", | |
"thumb" : "images/BigBuckBunny.jpg", | |
"title" : "Big Buck Bunny" | |
}, | |
{ "description" : "The first Blender Open Movie from 2006", | |
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ], |
There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore
is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules
directory) as well as files that are generated (and regenerated) as artifacts of a build process.
All other files should be in your own global gitignore file:
- Create a file called
.gitignore
in your home directory and add any filepath patterns you want to ignore. - Tell git where your global gitignore file is.
Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could substitute
.config/git/ignore
for.gitignore
in your home directory, if you prefer.