Skip to content

Instantly share code, notes, and snippets.

@kaievns
kaievns / gist:996893
Created May 28, 2011 14:20
Cubic Bezier function emulator
/**
* Cubic Bezier CSS3 transitions emulator
*
* See this post for more details
* http://st-on-it.blogspot.com/2011/05/calculating-cubic-bezier-function.html
*
* Copyright (C) 2011 Nikolay Nemshilov
*/
function Bezier(p1,p2,p3,p4) {
// defining the bezier functions in the polynomial form
@kaievns
kaievns / gist:908025
Created April 7, 2011 15:38
Jasmine Hack
// hacking jasmine over
var jasmine = require('jasmine-node');
var original_it = it;
var original_expect = expect;
var original_describe = describe;
global.it = function(desc, callback) {
if (typeof(desc) !== 'string') {
for (var key in desc) {
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<title>Draggable Issue</title>
<script type="text/javascript" src="http://cdn.rightjs.org/right.js"></script>
<script type="text/javascript" src="http://cdn.rightjs.org/plugins/dnd.js"></script>
</head>
<body>
<div style="margin: 10px auto;max-width:1180px;position:relative;height:710px;clear:both;overflow:scroll;background-color:grey">
<div rel="draggable" style="position: absolute; right: 0; background-color: green; width: 100px; height: 100px"></div>
sudo -s
gem install rubygems-update -v 1.3.7
gem uninstall rubygems-update -v 1.5.0
update_rubygems
@kaievns
kaievns / gist:758876
Created December 29, 2010 18:47
IE < 9 check
function is_IE8_or_less() {
try {
document.createElement('<input/>');
// IE8 or less
return true;
} catch(e) {
// IE9 or a W3C browser
return false;
}
}
// a simple custom wrapper
var Widget = new Class(Element, {
initialize: function(raw_element) {
// calling the Element's constructor
this.$super(raw_element, {
'class': 'my-widget'
});
},
// some other custom methods
var Keyboard = new Class({
prebind: 'handler',
initialize: function() {
$(document).on({
keypress: this.handler,
keyup: this.handler
});
},
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>RightJS Growl Example</title>
<link href="demo.css" media="screen" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://rightjs.org/hotlink/right.js"></script>
<script type="text/javascript" src="../src/rightjs-growl.js"></script>
<script type="text/javascript">
"a.regular-growl".onClick(function(e){
<dl id="tutorials-index">
<dt>Beginner Topics</dt>
<ul>
<%= menu_link_to "Getting Started", tutorial_path('getting-started') %>
<%= menu_link_to "Top 12 Features", tutorial_path('top-features') %>
</ul>
<dt>Basic Features</dt>
<ul>
<%= menu_link_to "Call By Name", tutorial_path('call-by-name') %>
"#title".onClick(function() {
this.highlight();
});
"#boom".onClick(function(event) {
event.stop();
$('title').fade();
});
"#time".onClick(function(event) {