DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • DIG in Your GIT — Best Practices

Trending

  • Adopting Agile Practices for Workforce Management: Benefits, Challenges, and Practices
  • Unlocking Opportunities: The Advantages of Certifications for Software Engineers
  • Demystifying Enterprise Integration Patterns: Bridging the Gap Between Systems
  • What You Must Know About Rate Limiting

Crazy Cool Chrome Extension (and How to Dig into the Source)

Raymond Camden user avatar by
Raymond Camden
·
Apr. 23, 15 · Interview
Like (0)
Save
Tweet
Share
2.85K Views

Join the DZone community and get the full member experience.

Join For Free

i’m learning some interesting stuff at fluentconf and i’ll talk more about that when the conference wraps, but i want to share something i found yesterday that i thought was really freaking cool. it is a chrome extension called momentum . apparently this was all over the place a few weeks ago so i’m late to the party, but it replaces your “new tab” screen with an absolutely beautiful (and somewhat useful) design:

nt1

you can customize it a bit, but really, it’s just that – a beautiful picture and a greeting. the text, “patience”, comes from the app prompting you the first time you open a a new tab in the morning:

nt2

which – ok – maybe it is a bit dorky – but i like it. i was also a bit curious about how it worked. chrome extensions are built with web standards, so i decided to take a quick look at the code.

to find your chrome extensions, you first need to find where your profile is. open up chrome://version and you’ll see a “profile path” folder. get to that directory and then enter the extensions folder. here you’ll see this wonderfully helpful list of directories (obviously different for each user):

shot1

ok, wow, so, now what? well next go to your chrome extensions tag ( chrome://extensions/ ), and find the extension. make note of the id value:

shot2

you would then enter the directory with the same id as the extension. at this point, you can dig through the assets and see how they do – well – what they do.

shot3

what i found out about momentum is that the background images are stored locally, which makes sense because you could be offline, and they ship quite a few of them. i also took a look at their javascript libraries to see how they built it. it is a backbone app which is cool, but not a framework i’m really interested in anymore.

the core logic was minified, but that doesn’t really slow you down. i opened a new tab, and then opened dev tools. i went to the minified file and clicked pretty print:

shot4

which then gave me nice, readable text:

shot5

i then selected all and copied into an editor so i could go through it in a proper tool. for me, the real interesting tidbit i found was how they handle weather. they use yql , a yahoo api i’ve blogged about before, but i really don’t see many people using. it is a very cool api so i’m happy to see it in action. if your curious how they use it, this is the block that grabs your current weather:

function n(e) {
    var t = "https://query.yahooapis.com/v1/public/yql?q=" + encodeuricomponent("select * from weather.forecast where woeid=" + e + ' and u="' + s.model.get("unit") + '"') + "&format=json&callback=?";
    $.getjson(t, function(e) {
        if (e && e.query && 1 == e.query.count) {
            var t = e.query.results.channel.item.condition;
            t && s.model.save({temperature: t.temp,code: t.code,condition: t.text,updated: new date})
        } else
            console.log("error getting weather data: result count not equal to one")
    }).error(function(e) {
        console.log("error getting weather data: " + e)
    })
}

yes – the yql api is sql like for data. very cool stuff. anyway, check out the extension, and don’t forget you can dig into the code and learn from them as well!

Dig (command)

Published at DZone with permission of Raymond Camden, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • DIG in Your GIT — Best Practices

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: