Skip to content

Instantly share code, notes, and snippets.

@bpizzi
bpizzi / gist:669191
Created November 9, 2010 15:00
Nginx site conf for symfony 1.4
We couldn’t find that file to show.
@davidalexander
davidalexander / gist:1086455
Last active July 12, 2024 07:05
Magento Snippets

Magento Snippets

Download extension manually using pear/mage

Pear for 1.4, mage for 1.5. File downloaded into /downloader/.cache/community/

./pear download magento-community/Shipping_Agent
./mage download community Shipping_Agent

Clear cache/reindex

@realmyst
realmyst / gist:1262561
Created October 4, 2011 19:34
Склонение числительных в javascript
function declOfNum(number, titles) {
cases = [2, 0, 1, 1, 1, 2];
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
}
use:
declOfNum(count, ['найдена', 'найдено', 'найдены']);
@ocean90
ocean90 / box-shadow.html
Last active July 12, 2024 04:58
CSS3 Box Shadow, only top/right/bottom/left and all
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;
@mrinalwadhwa
mrinalwadhwa / clearfix.css
Created June 15, 2012 05:37
CSS clearfix
/* based on http://www.yuiblog.com/blog/2010/09/27/clearfix-reloaded-overflowhidden-demystified/ */
.cf:before,
.cf:after {
content: ".";
display: block;
height: 0;
overflow: hidden;
}
.cf:after {clear: both;}
@joelpt
joelpt / squirt.js
Created October 2, 2012 23:41
Manually calculate the square root of a number with Javascript
// The Babylonian Method
// http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
// @param n - the number to compute the square root of
// @param g - the best guess so far (can omit from initial call)
function squirt(n, g) {
if (!g) {
// Take an initial guess at the square root
g = n / 2.0;
}
var d = n / g; // Divide our guess into the number
@snowman-repos
snowman-repos / Move cursor to the end of text input
Last active February 24, 2020 21:05
JavaScript: Move cursor to the end of text input
function moveCursorToEnd(el) {
if (typeof el.selectionStart == "number") {
el.selectionStart = el.selectionEnd = el.value.length;
} else if (typeof el.createTextRange != "undefined") {
el.focus();
var range = el.createTextRange();
range.collapse(false);
range.select();
}
}
@jayj
jayj / flexbox.less
Last active June 23, 2024 01:14
CSS3 Flexbox - LESS Mixins
// --------------------------------------------------
// Flexbox LESS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
// flex or inline-flex
.flex-display(@display: flex) {
display: ~"-webkit-@{display}";
display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox
@sym3tri
sym3tri / monad.js
Last active February 24, 2020 02:31
Simple Monad example in JavaScript
// as discussed by Crockford here: http://www.youtube.com/watch?v=dkZFtimgAcM
// more detailed example here: https://github.com/douglascrockford/monad/blob/master/monad.js
function MONAD() {
return function unit(value) {
var monad = Object.create(null);
monad.bind = function (func) {
return func(value);
};
return monad;
@magnetikonline
magnetikonline / README.md
Last active March 14, 2024 22:48
IE 7/8/9/10/11 Virtual machines from Microsoft - Linux w/VirtualBox installation notes.