GithubHelp home page GithubHelp logo

imclab / jquery-bling Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dcneiner/jquery-bling

0.0 2.0 0.0 60 KB

Sample code used in a live coding presentation at Front End Design Conference.

Home Page: http://www.slideshare.net/dcneiner/jquery-nuts-bolts-and-bling

jquery-bling's Introduction

jQuery: Nuts, Bolts and Bling โ€“ Live Coding Source Code

This code was used in the jQuery: Nuts, Bolts and Bling presentation delivered at Front End Design Conference in St. Petersburg, FL.

Important! Because we are using AJAX, you cannot run this at the file:// protocol in some browsers. To run this code you need to run it at http://. The easiest way to do this is to upload it to a personal website and play with it there. The next easiest (If you are on a Mac), is to open Terminal and navigate to the directory where this file lives. Then run:

python -m SimpleHTTPServer

Then point your browser to http://0.0.0.0:8000 and try out the files.

Most of this code was revealed during the live coding session. Only the result remains in this source code format (With the exception of some of the steps used in the doTimeout section). Here are a few notes about the concepts presented:

jQuery Mockjax

We use the Mockjax plugin to fake a request to the Dribbble API and return test data.

The process for generating our test data file (mocks/johnneiner.js) was:

  1. Visit the API endpoint on the Dribbble api, in this case: http://api.dribbble.com/players/johnneiner/shots
  2. Save this file as mocks/johnneiner.js
  3. Open the file and add var johnneiner = to the beginning, and ; at the end.
  4. Include this new js file on our page with our mocks

We are simulating a cross domain request and I ran into some issues using the normal mockjax proxy method, so I took this approach instead. If I find a better workaround, or mockjax is updated to make this easier, I will try to update this repository to reflect that.

Then, you add the code found in mocks/mocks.js

To test that our fake data works like the real data, simply remove the three mock <script> tags from index.html.

jQuery Tmpl

The point of showing this plugin was not to say this is the end-all of templating libraries for JS, but instead to show the concept of separating HTML from JavaScript in a clear way. This code is also in its final state from the presentation, but you can see the important pieces in the script#shot-template in index.html, and also in the first section of code in js/script.js.

jQuery doTimeout

Ben Alman's [jQuery.doTimeout] plugin makes dealing with timers almost effortless. During the live coding session, we looked at how to implement this plugin to get some great results.

If you want to follow along on the progression we took during the live coding session, visit the bottom of js/script.js and one by one uncomment first_try, second_try, etc. Be sure to only have one uncommented at a time. Don't leave first_try and third_try running at the same time, for instance.

final_try is of course the final working interaction. The comments in the script.js file explain about the expected interactions at each stage, and any problems you might see during that time.

Font License

Please see the SIL Open Font License 1.1.txt file in the fonts/ostrich-sans-fontfacekit directory for information on the license for the Ostrich Sans web font used in this project. @font-face kit used was downloaded from Font Squirrel.

Included Libraries and Assets

Code License (MIT)

All code not mentioned in the Font or Included Libraries section (excluding the data returned from the Dribbble API) uses the following license:

Copyright (c) 2011 Douglas C. Neiner

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

jquery-bling's People

Contributors

dcneiner avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.