Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

Monday, January 26, 2015

The Great FireWall of China and Web Development

The new leader of China, Xi Jinping, had strengthened the Internet Censorship in China. Beginning this new year, all Google services became inaccessible from mainland. 

The impact is severe, for that it does not only affect the well-known Google Services - Gmail, Google Drive, Google Play, etc - but also developer-oriented services, such as Google App Engine. Furthermore, since many scripts and fonts are hosted on Google CDNs, the total banning of Google services has rendered tons of websites not related to Google ugly or non-functional. Many modern websites rely on Javascript to function correctly, not to mention web apps.

Before going back to China I was wondering if it would be necessary to develop websites that still works without Javascript. As far as I know, that's a compatibility requirement even rarer than "This has to work on IE6". During this winter in China I have experienced what it's like to use the Web this way, and it's not pretty. Sometimes I have to use view-source to extract the information I want. The modern web has already became heavily javascript-dependent, and from how it looks in the industry, there is no going back.

Maybe a wise thing to do is to keep in mind that there would be users accessing your website without the Javascript functioning. My experience in China is a pretty unique situation, but there are many other situations that might break your javascript on the user's computer. A broken website that still has the information the user is looking for with some ugly default fonts and misplaced CSS is better than nothing at all.

P.S. This post is not an excuse for my low productivity this winter.
P.P.S. Since so many important services became inaccessible, especially Gmail, I took the opportunity and installed Firewall-breaching softwares on my family members' computers. Another major victory for Chinese Democracy.

Tuesday, October 14, 2014

The "wonderfulness" of Javascript types

> le me, opens js console
> parseInt("derp")
> NaN
> typeof parseInt("derp")
> "number"




One day I will understand the design philosophy behind all that weird javascript types, and I will transcend into something else, something more than a front end code monkey.

But that day is not today.

Tuesday, April 22, 2014

="/......" vs ="......"

That title is totally not emoticon.


In web development, if a relative URL starts with a slash:

href="/css/bootstrap.css"

It would point back to the root directory of current site, then go down the url, turning into "http://changbai.li/css/bootstrap.css"


But if it doesn't lead with a slash:

href="css/bootstrap.css"

It would start going down the url from the local directory. Say that code is inside changbai.li/work/ninja/index.html, then it'll point to "http://changbai.li/work/ninja/css/bootstrap.css"

I can't exaggerate how useful this is. Or how fun it'll be to mess with developers using this*.


*Don't do that.

Saturday, April 12, 2014

Styling in Chrome Console

So uh, apparently you can use CSS styling for Chrome Console. Even include emoticons.

Link.

This would actually be pretty useful for debugging!

Also - having easter-eggs in console messages is pretty awesome. I should add that for my site.

Tuesday, April 8, 2014

Working with Adobe Scripting

So my teacher Joe Pietruch introduced us to the wonderful world of manipulating Adobe tools with code. You can do it for Illustrator, Photoshop, InDesign, Acrobat, and After Effect. Quite nifty!

Here's the scripting guide and here's the Javascript API reference. The scripts will be edited and ran inside the tool Adobe ExtendScript.

It's pretty much all classic javascript, and for debugging I'm finding $.writeln(); or $.write(); to be quite useful. It's equivalent to console.log(), and it will show up on the javascript console window at the upper right corner of ExtendScript. Another useful thing is to have #target illustrator (or photoshop, or indesign...) at the top of codes. This will let you automatically run the script for that program when you try to open it.

RIT Alumni Josh Hutchins developed a tool that takes an entire folder of images, shrink them to one pixel width, and stack them together to create a colorful barcode. Pretty cool! I'm looking for suggestions of cool / useful things you can do with this power.

Leave a suggestion, and i might find a chance to develop it and add to my repo here! As the post is created, there's one script about duplicating items around a center point for some amount of times.

// DISCLAIMER: The Developers are not responsible for any program crashes caused by running the scripts. Use at your own risk.

P.S. Just found a community that makes these scripts for illustrator. Damn.