This file contains 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
(function(){ | |
var copyToClipboard = str => { | |
var el = document.createElement('textarea'); // Create a <textarea> element | |
el.value = str; // Set its value to the string that you want copied | |
el.setAttribute('readonly', ''); // Make it readonly to be tamper-proof | |
el.style.position = 'absolute'; | |
el.style.left = '-9999px'; // Move outside the screen to make it invisible | |
document.body.appendChild(el); // Append the <textarea> element to the HTML document | |
var selected = | |
document.getSelection().rangeCount > 0 // Check if there is any content selected previously |
This file contains 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
module IsOrderable | |
extend ActiveRecord::Concern | |
def change_position_to(n) | |
safe_n = self.class.sanitize(n) | |
current_position = self.class.sanitize(position) | |
connection.execute(<<-SQL | |
BEGIN; | |
UPDATE #{self.class.table_name} SET position = position + 1 WHERE parent_id = #{parent_id} AND position < #{current_position} AND position >= #{safe_n}; | |
UPDATE #{self.class.table_name} SET position = position - 1 WHERE parent_id = #{parent_id} AND position > #{current_position} AND position <= #{safe_n}; |
This file contains 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
(function(){ | |
var transform = function(el,pt){ | |
return pt.matrixTransform( el.getScreenCTM().inverse() ); | |
}; | |
$.fn.extend({ | |
reportLocations : function(callback){ | |
var $this = this; | |
var svg = $this.closest('svg')[0]; | |
var pt = svg.createSVGPoint(); |
This file contains 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
class Product < ActiveRecord::Base | |
attr_accessible :description, :imageurl, :price, :size, :title | |
validates_presence_of :title, :price, :description, :imageurl, :size | |
validates :title, :length => { :maximum => 50 }, :uniqueness => { :case_sensitive => false } | |
validates :description, :length => { :maximum => 250 } | |
validates :price, :format => { :with => /[\d\,]*\.\d{2}$/ } | |
validates :imageurl, :format => { :with => /#{URI::regexp}\.(jpg|png|gif)$/i } | |
validates :size, :inclusion => { :in => %w(small medium large) } | |
end |
This file contains 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
<!DOCTYPE html> | |
<html lang='en'> | |
<head> | |
<script src="http://code.jquery.com/jquery-latest.js"></script> | |
<meta charset="UTF-8"> | |
<style> | |
.cell{ | |
width:50px ; | |
height:50px; | |
padding: 0px; |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>AR Tutor Example</title> | |
<meta name="description" content="Example tabable nav with Twitter Bootstrap"> | |
<link href="./bootstrap.css" rel="stylesheet"> | |
<style type="text/css"> | |
textarea { | |
font-family: "Monaco",monospace |
This file contains 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
{ | |
"survey_id": 1, | |
"title": "Baseline Survey (Draft)", | |
"introduction": "Thank you for taking the time to participate in this survey of SamaHub workers. The purpose of this survey is to better understand the background and demographics of our workers in order to continue to deliver the best work opportunities through the SamaHub. \n\nThere are no ‘wrong’ answers and all information collected will be strictly private and anonymous at the individual level. The survey is comprised of a total of 55 short questions and will take approximately 25 minutes to complete. \n\nSamaHub workers will be surveyed regularly (1-2 times a year) through the SamaHub; additionally, with the permission of the respondent, a selection of SamaHub workers may also be contacted in-person or via telephone for questions.", | |
"sections": [ | |
{ | |
"section_id": "A", | |
"title": "Part A: Basic Information", | |
"questions": [ | |
{ |
This file contains 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
<?xml version="1.0" encoding="utf-8" ?> | |
<!-- SQL XML created by WWW SQL Designer, http://code.google.com/p/wwwsqldesigner/ --> | |
<!-- Active URL: http://socrates.devbootcamp.com/sql.html --> | |
<sql> | |
<datatypes db="mysql"> | |
<group label="Numeric" color="rgb(238,238,170)"> | |
<type label="Integer" length="0" sql="INTEGER" re="INT" quote=""/> | |
<type label="Decimal" length="1" sql="DECIMAL" re="DEC" quote=""/> | |
<type label="Single precision" length="0" sql="FLOAT" quote=""/> | |
<type label="Double precision" length="0" sql="DOUBLE" re="DOUBLE" quote=""/> |
This file contains 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
class Task | |
attr_accessor :unique_id, :description, :creation_time, :completion_time | |
def initialize(description,task_list) | |
@description = description | |
@unique_id = task_list.task_counter | |
@creation_time = Time.now | |
@completion_time = nil | |
task_list.add(self) |
This file contains 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
# Dependencies | |
require "csv" | |
require 'sunlight' | |
# Class Definition | |
class EventManager | |
INVALID_ZIPCODE = "00000" | |
INVALID_PHONE_NUMBER = "0000000000" |
NewerOlder