Skip to content

Instantly share code, notes, and snippets.

View aarongustafson's full-sized avatar
👋
he/him/his

Aaron Gustafson aarongustafson

👋
he/him/his
View GitHub Profile
@aarongustafson
aarongustafson / using-cssText.js
Created December 6, 2009 15:01
If you can get away with it, use style.cssText instead of style
element.style.cssText = 'font-size:12px;text-indent:0';
element.style.cssText = 'font-size:14px;text-indent:5px';
var script = document.createElement('script');
script.src = "myobject.js";
script.text = "myobject.init()";
document.getElementsByTagName('head')[0].appendChild(script);
var
allPara = document.getElementsByTagName('p'),
collectTemp = [];
for ( var i = 0; i < allPara.length; i++ )
{
collectTemp[collectTemp.length] = allPara[i];
}
for ( i = 0; i < collectTemp.length; i++ )
{
collectTemp.appendChild( document.createTextNode(i) );
YUI().use('json',function(Y){
function clone( obj )
{
return Y.JSON.parse( Y.JSON.stringify( obj ) );
}
});
@aarongustafson
aarongustafson / benchmarking-closure-vs-classical-inheritance.html
Created December 14, 2009 13:35
Used in combination with the benchmark.js file from JavaScript Performance Rocks
<script src="benchmark.js"></script>
<h2>classical inheritance vs. closures</h2>
<p>
<span id="test">test</span>
</p>
<script type="text/javascript">
// Closure implementation
<h1 id="branding">
<img src="/images/logo-print.jpg" alt="Twinings of London" />
</h1>
{exp:weblog:entries weblog="services"
disable="categories|category_fields|member_data|pagination|trackbacks"}
{exp:query sql="SELECT @row := 0"}{/exp:query}
{exp:query sql="SELECT @row := @row + 1 AS `query_count`
`project`.`title` AS `project_name`
FROM `exp_weblog_titles` AS `project`
INNER JOIN `exp_relationships` AS `service_projects` ON `project`.`entry_id` = `service_projects`.`rel_parent_id`
WHERE `project`.`weblog_id` = 13
AND `service_projects`.`rel_child_id` = {entry_id}
LIMIT 10"}
@font-face {
font-family: 'Comfortaa';
font-weight: normal;
src: url('fonts/Comfortaa_Regular.eot');
src: local('Comfortaa'),
url('fonts/Comfortaa_Regular.ttf') format('truetype'),
url('fonts/Comfortaa_Regular.otf') format('opentype'),
url('fonts/Comfortaa_Regular.svg#mysvgid') format('svg');
}
eCSStender.addMethod('findBySelector',Sizzle);
/* ---------------------------------
* Core Stylesheet
* Created by Easy! Designs, LLC
* http://easy-designs.net
* --------------------------------- */
{embed="styles/reset"}
{embed="styles/typography"}