This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.fn.validateImageUpload = function(size){ | |
| //Accepts form file input fields $('input[type=file]').validateImageUpload(); | |
| //Also accepts size validation (in K), default is 700. Set to false in order to skip check | |
| if(typeof size != "number" && size%1 != 0){size = 700} | |
| var validate = function(x){ | |
| var files = $(x).get(0).files, that = x; | |
| for (i = 0; i < files.length; i++){ | |
| if(!files[i].type.match(/(gif|jpg|JPG|jpeg|JPEG|gif|GIF|png|PNG)/)){ | |
| alert('Must be an image file.'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| javascript:(function()%7Bif(typeof%20jQuery%20%3D%3D%20'function')%7Bdelete%20jQuery%3B%7Dvar%20newscript%20%3D%20document.createElement('script')%3Bnewscript.type%20%3D%20'text%2Fjavascript'%3Bnewscript.async%20%3D%20true%3Bnewscript.src%20%3D%20'https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1%2Fjquery.min.js'%3B(document.getElementsByTagName('head')%5B0%5D%7C%7Cdocument.getElementsByTagName('body')%5B0%5D).appendChild(newscript)%3B%7D)()%3B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var textareas = document.getElementById('user_summary'); | |
| for (var i = textareas.length; i--;) { | |
| if (textareas[i].getAttribute('maxlength') && !textareas[i].maxlength) { | |
| var max = textareas[i].getAttribute('maxlength'); | |
| textareas[i].onkeypress = function(event) { | |
| var k = event ? event.which : window.event.keyCode; | |
| if(this.value.length >= max) if(k>46 && k<112 || k>123) return false; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String.prototype.recursiveReplace = function(a,b){ | |
| var newString = this; | |
| while(newString.match(a) !== null){newString = newString.replace(a,b);} | |
| return newString; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| JS Extentions by Mild Fuzz | |
| */ | |
| (function(){ | |
| //Adds sum functionality to the Array object | |
| Array.prototype.sum = function(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Store for localised behaviours | |
| * | |
| * Requires jquery and Mild Fuzz's plugins.js (http://goo.gl/MVcH2) | |
| * @mildfuzz | |
| * | |
| * Usage | |
| * | |
| * Create behaviour within case: | |
| * case "BehaviourString": | |
| * //some function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Requires Compass | |
| .cover_slide{ | |
| position: fixed; | |
| top: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; | |
| background: rgba(0, 0, 0, 0.5); | |
| z-index: 9999; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| has_attached_file :photo, | |
| :styles => { | |
| :tiny => "100x100", # fixed width and height | |
| :thumb => "100>x100", # resize to a fixed width if original height if greather than specified | |
| # dimension and fixed height | |
| :small => "200x200>", # fixed width and resize to a fixed height if original height i greather than | |
| # specified dimension | |
| :medium => "200 "200x200<" # fixed width and resize to a fixed heigth if original height i less | |
| # than specified dimension | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ActiveAdmin.register User do | |
| filter :first_name | |
| filter :last_name | |
| filter :company_name | |
| filter :email | |
| form do |f| | |
| f.inputs "Contact" do | |
| f.input :first_name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| scope :scope, where("column=value") | |
| scope :scope_with_input, lambda { |value| where("column =?", value)} | |
| scope :cope_with_join_and_input, lambda { |value| joins(:other_table).where("other_table.other_table_column =?", value)} |