Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html ng-app="myApp">
<head>
<title></title>
</head>
<body ng-controller="MainCtrl">
{{ menu }}
<div>
@mrosati84
mrosati84 / devify
Last active August 29, 2015 14:04
Easily manage projects using H-ART Dev Machine
#!/bin/bash
# create Dev Machine structure
function createStructure {
# TODO
# 1- check existing folders
# 2- ask user for overwriting
if [ -d manifests ] ||
[ -d modules ] ||
[ -d xdebug ] ||
@mrosati84
mrosati84 / drag_to_upload.js
Last active August 29, 2015 14:06
A super-simple jQuery plugin that handles drag-to-upload files
(function(window, document, $) {
'use strict';
if ( ! String.hasOwnProperty('hashCode') ) {
/**
* returns a hash code from a base string
* @return {string}
*/
String.prototype.hashCode = function() {
var hash = 0, i, chr, len;
@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,
@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 / 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 / jquery.exists.js
Created January 2, 2013 17:23
jQuery exists plugin
;(function($) {
$.fn.exists = function() {
return this.length > 0;
};
}(jQuery));
@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 / 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 / angular_http_request
Created March 13, 2013 11:33
An Angular.js example for making XHR calls
---
The html file "index.html"
---
<!DOCTYPE html>
<html ng-app>
<head>
<meta charset="utf-8">
<title></title>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.1/angular.min.js"></script>