-
Being able to edit JS source after prettifying #103143
-
Jump to function definition (or see prettifyed function definition) #248647
-
Better JS prettifying (e.g. newlines after ",") #383933
-
Cmd/Ctrl + P
in sources to do fuzzy matching (e.g. "all js" doesn't find "all.js", like Sublime does) #383945 -
Smarter console auto-suggest
alert(console.)
doesn't show suggestions
This file contains hidden or 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
<!-- | |
<component-name>[--modifier-name|__descendent-name] | |
.component {} | |
.component__descendant {} | |
.component--modifier {} | |
--> | |
<article class="tweet tweet--is-expanded"> | |
<header class="tweet__header"> |
This file contains hidden or 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
function formatSchedule(schedules) { | |
var dayAbbr = [ 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс' ]; | |
function dayIndicesToWord(indices) { | |
if (areDayIndicesSequential(indices)) { | |
return dayAbbr[indices[0]] + '-' + dayAbbr[_.last(indices)]; | |
} | |
else { | |
var daysAsWords = _.map(indices, function(index) { | |
return dayAbbr[index]; |
This file contains hidden or 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
function formatSchedule(schedules) { | |
var dayAbbr = [ 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс' ]; | |
function dayIndicesToWord(indices) { | |
if (areDayIndicesSequential(indices)) { | |
return dayAbbr[indices[0]] + '-' + dayAbbr[_.last(indices)]; | |
} | |
else { | |
var daysAsWords = _.map(indices, function(index) { | |
return dayAbbr[index]; |
This file contains hidden or 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
console.highlight = function(text, sample) { | |
var escapedSample = sample.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); | |
var reSample = new RegExp(escapedSample, 'g'); | |
var args = ['']; | |
var highlightedText = text.replace(reSample, function(match) { | |
args.push('background-color: #ffc', 'background-color: none'); | |
return '%c' + match + '%c'; | |
}); | |
args[0] = highlightedText; | |
console.log.apply(console, args); |
Computes a new version of a String value in which certain characters have been escaped, so that the regular expression engine will interpret any metacharacters that it may contain as character literals.
When the escape function is called with one argument string, the following steps are taken:
- Let string be ToString(string).
- ReturnIfAbrupt(string).
- Let length be the number of characters in string.
- Let R be the empty string.
This file contains hidden or 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
// create new card | |
$('.js-add-list-popover').click(); | |
var d = new Date(); | |
var year = (d.getFullYear()+'').substring(2); | |
var month = d.getMonth() + 1; | |
var day = d.getDate(); | |
var cardName = 'Published (' + month + '-' + day + '-' + year + ')'; | |
$('.js-list-name').val(cardName); |
This file contains hidden or 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
(function(d, s) { | |
var deps = { | |
twitter: [ | |
"//platform.twitter.com/widgets.js", | |
"twitter-wjs" | |
], | |
facebook: [ | |
"//connect.facebook.net/en_US/all.js#xfbml=1", | |
"facebook-jssdk" |
This file contains hidden or 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
// run on http://browser.primatelabs.com/mac-benchmarks | |
function findFirst(text) { | |
return $('td a').filter(function(i, el){ return $(el).text().indexOf(text) > -1 }).eq(0).closest('tr'); | |
} | |
var mine = findFirst('MacBook Pro (17-inch Early 2011)'); | |
var topMbp = findFirst('MacBook Pro'); | |
$('tbody tr').hide().eq(0).show(); |
This file contains hidden or 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 URL = require('url'), | |
HTTP = require('http'), | |
Canvas = require('canvas'), | |
Image = Canvas.Image, | |
img = new Image(), | |
canvas = new Canvas(200,200), | |
ctx = canvas.getContext('2d'), | |
// throws "Error: Image given has not completed loading" |