Skip to content

Instantly share code, notes, and snippets.

@cms
cms / getStyle.js
Created April 17, 2010 00:48
Get computed styles
function getStyle(el, styleProp) {
var value, defaultView = el.ownerDocument.defaultView;
// W3C standard way:
if (defaultView && defaultView.getComputedStyle) {
// sanitize property name to css notation (hypen separated words eg. font-Size)
styleProp = styleProp.replace(/([A-Z])/g, "-$1").toLowerCase();
return defaultView.getComputedStyle(el, null).getPropertyValue(styleProp);
} else if (el.currentStyle) { // IE
// sanitize property name to camelCase
styleProp = styleProp.replace(/\-(\w)/g, function(str, letter) {
(function($){
$.widget("ui.mywidget", {
options: {
autoOpen: true
},
_create: function(){
// by default, consider this thing closed.
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
meter{
display: block;
border: 1px outset;
height: 20px;
width: 100px;
overflow: hidden;
}
meter div
{
display: block;
@nikreiman
nikreiman / YourProjectName.cpp
Created December 10, 2010 08:52
Code snippits for a VST plugin written for Windows
#include "YourProjectName.h"
AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {
return new YourProjectName(audioMaster);
}
YourProjectName::YourProjectName(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, 0, NUM_PARAMS) {
}
YourProjectName::~YourProjectName() {
@cms
cms / isStrictFunction.js
Created March 2, 2011 06:35
isStrictFunction
function isStrictFunction(fn) {
if (typeof fn != 'function') throw "Not a function";
try {
fn.caller, fn.arguments;
return false;
} catch (e) {
return e instanceof TypeError;
}
}
/*
* Property prefix hacks
*/
/* IE6 only - any combination of these characters */
_ - £ ¬ ¦
/* IE6/7 only - any combination of these characters */
@kimoto
kimoto / sin_is_god.txt
Created July 6, 2011 08:13
sin関数の使い方についてハイテンションで迫る文章
sin関数の魅力に迫る!
これは超ハイテンションでsin関数の魅力に迫るという文章です
sin関数は入力された角度(ラジアン)を元に、-1から1までのあいだの値を返却します
sin関数は周期的な特徴があって入力する値を増やしていくと...
-----------------
sin(0) = 0
sin(1) = 0.1
sin(2) = 0.14
...
@hail2u
hail2u / csslint-rules.md
Last active April 29, 2023 14:59
CSSLintのRulesの超訳

訳注

これは超訳です。

CSSLintは「なんでこんなルールなんだ…」とイラっとすることが多いですけど、それぞれにそれなりに理由があります。まぁ勿論無視するべきなルールとかもあります。例えば見出し要素の再定義禁止とかはHTML5に対するCSSなら無理な話です。そんなわけでどんな理由なのかを簡単に訳しました。無視するかどうかは自分で決めましょう!

この訳はCSSLintと同じライセンスで提供されます。

Possible Errors

@terkel
terkel / reset.css
Created November 12, 2011 10:56
CSS Reset
/*!
* CSS Reset 2011-12-25
* https://gist.github.com/gists/1360380
*
* Author: Takeru Suzuki, http://terkel.jp/
* License: Public domain
*
* Inspired by Normalize.css: http://necolas.github.com/normalize.css/
*/