Skip to content

Instantly share code, notes, and snippets.

View JoeyBurzynski's full-sized avatar
💭
Hacking away on @EdgeSEO tools.

Joey Burzynski JoeyBurzynski

💭
Hacking away on @EdgeSEO tools.
View GitHub Profile
1. Class selector - .<classname>
2. Id selector - #<id>
3. Scope selector - .<classname><space>.<dusra_classname>
4. Immediate child selector - .<classname>">".<child_classname>
5. Attribute selector - [<attributename>='<value>'] OR [<attributename>]
6. Tag selector - "<tagname>"
7. DOM element - Directly pass the element to jquery function
8. Multiple element - separate selectors using <comma>
@JoeyBurzynski
JoeyBurzynski / slack.sh
Created May 1, 2016 18:41 — forked from amberovsky/slack.sh
Slack incoming webhooks from bash (send notification to slack from shell)
read -d '' SLACK_PAYLOAD_DATA << EOF
{
"channel": "#channel",
"username": "Bot",
"text": "Message by _$(id -un)@$(hostname -f)_.",
"icon_emoji": ":poop:",
"attachments": [
{
"fields": [
{
@JoeyBurzynski
JoeyBurzynski / index.html
Created May 4, 2016 13:07 — forked from anonymous/index.html
Chrome Desktop Notification Example // source https://jsbin.com/ziwod
<button onclick="notifyMe()">
Notify me!
</button>
<script id="jsbin-javascript">
// request permission on page load
document.addEventListener('DOMContentLoaded', function () {
if (Notification.permission !== "granted")
Notification.requestPermission();
});
@JoeyBurzynski
JoeyBurzynski / README.md
Created May 4, 2016 19:42 — forked from dciccale/README.md
Tiny Cross-browser DOM ready function in 111 bytes of JavaScript

DOM Ready

Tiny Cross-browser DOM ready function in 111 bytes of JavaScript.

@JoeyBurzynski
JoeyBurzynski / deferring_browser_javascript_execution.md
Created May 5, 2016 13:06
How To Defer Execution Of Javascript In The Browser

TL;DR: Use window.addEventListener(...) (see final heading)

You may want to defer execution of javascript until the DOM has loaded. For example, the following will not work.

function respondToEvent() {
    ... 
}
@JoeyBurzynski
JoeyBurzynski / codereview.md
Created May 6, 2016 18:11 — forked from addyosmani/codereview.md
Lessons from a JavaScript code review

#Lessons From A JavaScript Code Review

I was recently asked to review some code for a new JavaScript application and thought I might share some of the feedback I provided as it includes a mention of JavaScript fundamentals that are always useful to bear in mind. Code reviews are possibly the single biggest thing you can do to improve the overall quality of your solutions and if you're not actively taking advantage of them, you're possibly missing out on bugs you haven't noticed being found or suggestions for improvements that could make your code better.

##Challenges & Solutions

Code reviews go hand-in-hand with maintaining strong coding standards. That said, standards don't usually prevent logical errors or misunderstandings about the quirks of a programming language. Even the most experienced developers can make these kinds of mistakes and code reviews can greatly assist with catching them.

Often the most challenging part of code reviews is actually finding an experienced developer you trust to complete

@JoeyBurzynski
JoeyBurzynski / modules.md
Created May 15, 2016 20:30 — forked from JoshCheek/modules.md
Modules (lesson from 29 July 2015) covers object model, namespaces, mixins, and functions.

Modules

To understand modules, we first have to understand a little bit about how Ruby works. So, lets define the things that exist in Ruby and see how they work together. Then, we will be able to understand how modules fit into this, and what they are here for.

Definitions

@JoeyBurzynski
JoeyBurzynski / s3-invalidation.js
Created May 22, 2016 11:32 — forked from supinf/s3-invalidation.js
AWS Lambda script:: CloudFront Invalidations which are triggered by s3 events.
console.log('Loading event');
var Q = require('q');
var aws = require('aws-sdk');
var cloudfront = new aws.CloudFront();
exports.handler = function (event, context) {
//_log('Received event: ', event);
var bucket = event.Records[0].s3.bucket.name;
@JoeyBurzynski
JoeyBurzynski / eachAsync.js
Created June 24, 2016 01:44 — forked from dtao/eachAsync.js
Function to asynchronously iterate over a collection
function eachAsync(collection, iterator, callback) {
var iterate = function(i) {
setTimeout(function() {
iterator(collection[i]);
if (i < collection.length) {
iterate(i + 1);
} else {
callback();
}
}, 0);
@JoeyBurzynski
JoeyBurzynski / dipl.io.conf
Created June 30, 2016 13:51 — forked from spamguy/dipl.io.conf
An nginx configuration featuring HTTP/2, IPv6, Let's Encrypt SSL, and a decent cipher suite
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name www.dipl.io dipl.io;
return 301 https://dipl.io$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;