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
/** | |
* ============================================================================ | |
* MIT License | |
* | |
* Copyright (c) 2016 Eric Phillips | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a | |
* copy of this software and associated documentation files (the "Software"), | |
* to deal in the Software without restriction, including without limitation | |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
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
private bool planesIntersectAtSinglePoint( Plane p0, Plane p1, Plane p2, out Vector3 intersectionPoint ) | |
{ | |
const float EPSILON = 1e-4f; | |
var det = Vector3.Dot( Vector3.Cross( p0.normal, p1.normal ), p2.normal ); | |
if( det < EPSILON ) | |
{ | |
intersectionPoint = Vector3.zero; | |
return false; | |
} |
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($) { | |
// SIMPLE BOX | |
// make your own lightbox cuz they all suck | |
var imgSrc | |
, $simpleBox; | |
window.fitImg = function() { | |
var $img = $("#simple-box img"); |
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> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="author" content="Victor Stan"> | |
<meta name="description" content="Get multiple video streams on one page. Adapted from code by Muaz Khan"> | |
<title>Video Camera</title> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js" ></script> |
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
import opencv | |
#this is important for capturing/displaying images | |
from opencv import highgui | |
import pygame | |
import sys | |
camera = highgui.cvCreateCameraCapture(0) | |
def get_image(): | |
im = highgui.cvQueryFrame(camera) | |
# Add the line below if you need it (Ubuntu 8.04+) |
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
## PayRoll Application Gem | |
# lib/pay_roll/pay_day_service.rb | |
# Consider this Use Case as the Context in DCI | |
# | |
class PayRoll::PayDayService | |
def initialize(date=Date.today) | |
@date = date | |
# Employee could be any data source from the host, |
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
#http://blog.wyeworks.com/2009/7/13/paperclip-file-rename | |
Paperclip.interpolates :default_image_type do |attachment, style| | |
attachment.instance.get_user_default_profile_image | |
end | |
Paperclip.interpolates :normalized_avatar_file_name do |attachment, style| | |
attachment.instance.normalized_avatar_file_name | |
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
!default_rounded_amount ||= 5px | |
// Round corner at position by amount. | |
// values for position: "top-left", "top-right", "bottom-left", "bottom-right" | |
=round-corner(!position, !amount = !default_rounded_amount) | |
border-#{!position}-radius= !amount | |
-moz-border-#{!position}-radius= !amount | |
-webkit-border-#{!position}-radius= !amount | |
// Round left corners by amount |
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
//get first part of current url, without hash | |
var base_path = window.location.href.split("#")[0]; | |
var real_id = 0; | |
var current_page; | |
;(function($) { | |
//create new sammy app | |
var app = new Sammy.Application(function() { | |
with(this) { | |
//corresponds to routes like #/slide/1 | |
get('#/slide/:page_id', function() { with(this) { |
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() { | |
//run the accordion plugin, set height of sections to height of content | |
$("#accordion").accordion({ autoHeight: false }); | |
}); | |
;(function($) { | |
//write new sammy application | |
var app = new Sammy.Application(function() { | |
with(this) { | |
//corresponds to routes such as #/section/1 | |
get('#/section/:section_id', function() { with(this) { |
NewerOlder