Skip to content
My personal collection of d3.js code snippets for Sublime 2 (Time Saver!!!!)
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
attr.sublime-snippet
circle.sublime-snippet
comment.sublime-snippet
console.sublime-snippet
dfun.sublime-snippet
each.sublime-snippet
filter.sublime-snippet
gradient.sublime-snippet
group.sublime-snippet
join.sublime-snippet
line.sublime-snippet
margin.sublime-snippet
path.sublime-snippet
polygon.sublime-snippet
polyline.sublime-snippet
radial_gradient.sublime-snippet
randomcolor.sublime-snippet
rect.sublime-snippet
short_comment.sublime-snippet
stroke.sublime-snippet
style.sublime-snippet
text.sublime-snippet
turbulence.sublime-snippet
use.sublime-snippet
xscale.sublime-snippet
yscale.sublime-snippet

README.md

d3.js-Sublime-2-Snippets

My personal collection of d3.js code snippets for Sublime 2 (Time Saver!!!!). To support me buy my iPad app Vista Point for Travel Enthusiasts (0.99$)

HOW TO INSTALL

Browse to the following path on your UNIX system. Make sure you change the YOUR_USERNAME placeholder with your current user.

cd /Users/YOUR_USERNAME/Library/Application\ Support/Sublime\ Text\ 2/Packages/User/

If the folder 'JavaScript' doesn't exisits inside of this folder, create it:

mkdir JavaScript

Enter this folder:

cd JavaScript

I recommend to checkout the repository directly in this folder:

git clone git@github.com:roundrobin/d3.js-Sublime-2-Snippets.git .

Now you will see inside of the ./JavaScript folder, a bunch of .sublime-snippet files. Feel free to add new ones.

Restart Sublime 2.

HOW TO USE

After you've installed the snippets, you can trigger the insertion of a snippet by typing in one of the follwing commands inside of a .js file and pressing the TAB key afterwards.

The list of available snippets:

.a + TAB        ==> .attr("",)
  
.st + TAB       ==> .style("",)
  
circle + TAB    ==> append("circle")...
  
rect + TAB      ==> append("rect")...
  
text + TAB      ==> append('text')...
  
line + TAB      ==> append('line')...
  
polyline + TAB  ==> append('polyline')...
  
path + TAB      ==> append('path')....
  
polygon + TAB   ==> append('polygon')...
  
group + TAB     ==> append('group')...
                     
xscale + TAB    ==> var xscale = d3.scale.linear().domain(...
 
yscale + TAB    ==> var yscale = d3.scale.linear().domain(...
 
randcol + TAB   ==> '#'+Math.floor(Math.random()*16777215).toString(16);
 
join + TAB      ==> .selectAll("").data().enter().append("")...
 
con + TAB       ==> console.log('LOG:','')
 
dfun + TAB      ==> function(d,i){ return ''} 
 
margin + TAB    ==> var margin = {top: 0 ...
 
gradient + TAB  ==> var gradient = defs.append('linearGradient') ...
 
radial + TAB    ==> var gradient = defs.append('radialGradient') ...
 
con + TAB       ==> console.log("Log:", "");
 
filter + TAB    ==> defs.append('filter')
 


You can’t perform that action at this time.