Skip to content

Instantly share code, notes, and snippets.

@mrosati84
mrosati84 / restful_pattern.txt
Created January 5, 2013 19:48
Restful resource definition pattern
GET /photos index display a list of photos
GET /photos/new new return an HTML form for creating a new photo
POST /photos create create a new photo
GET /photos/:id show display a specific photo
GET /photos/:id/edit edit return an HTML form for editing a new photo
PUT /photos/:id update update a specific photo
DELETE /photos/:id destroy delete a specific photo
@mrosati84
mrosati84 / prototype_module_pattern.html
Created January 3, 2013 09:56
Augmenting an object's prototype using module pattern
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script type="text/javascript">
@mrosati84
mrosati84 / jquery.exists.js
Created January 2, 2013 17:23
jQuery exists plugin
;(function($) {
$.fn.exists = function() {
return this.length > 0;
};
}(jQuery));
@mrosati84
mrosati84 / hoisting.js
Created December 25, 2012 11:15
this gist explains function hoisting in javascript
(function () {
function foo() {
console.log('foo');
}
function bar() {
console.log('bar');
}
function hoistMe() {
@mrosati84
mrosati84 / visible_plugin.js
Created December 20, 2012 16:36
Simple jQuery plugin that checks if an element is in the visible viewport
(function ($) {
if ( typeof $ !== 'function' ) {
return false;
}
$.fn.inViewport = function () {
// assign this object to local variable.
// use raw DOM node, not jQuery objects.
@mrosati84
mrosati84 / responsive_iframe_slider.html
Last active May 24, 2019 15:51
Demo responsive iframe slider
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css">
<style type="text/css">
#slider {
width: 100%;
}
@mrosati84
mrosati84 / closure.js
Created November 13, 2012 14:12
Test closure
(function () {
var myObject = (function () {
var privateMember = 0;
// Return public methods
return {
init: function () {
},
@mrosati84
mrosati84 / Preferences.sublime-settings
Last active October 12, 2015 04:47
My Sublime Text 2/3 Settings
{
"binary_file_patterns":
[
"*.scssc"
],
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/User/Colorsublime/themes/Boron.tmTheme",
"draw_white_space": "all",
"fade_fold_buttons": false,