Skip to content

Instantly share code, notes, and snippets.

@dsueiro
dsueiro / find_version.php
Last active August 29, 2015 14:16
Looking for a certain module on a folder containing bare repositories with Magentos
<?php
if (count($argv) != 2) {
die("Usage:\n\tphp {$argv[0]} scope/module/folder\nExample:\tphp {$argv[0]} local/SemExpert/Oca # no bar at the end");
}
foreach(glob('*.git') as $dir) {
if (!chdir($dir)) {
continue;
}
$cmd = "git ls-tree -r master app/code/{$argv[1]}/etc/config.xml";
#echo "$cmd\n";
@dsueiro
dsueiro / .vimrc
Last active August 29, 2015 14:16 — forked from JeffreyWay/.vimrc
set nocompatible " Disable vi-compatibility
set t_Co=256
colorscheme xoria256
set guifont=menlo\ for\ powerline:h16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

@dsueiro
dsueiro / fibonacci.js
Last active August 29, 2015 14:14 — forked from Artanis/fibonacci.js
// Take a function and return a function that caches the results of
// that function.
//
// Setting debug to true will print the logic the caching function uses.
var memoize = function(fn, debug) {
// Caching object, in the form {args : value}
var cache = {};
// Caching function. No explicit args. Any args are fed into the
// memoized function via apply().
<?php
/**
* Set global/skip_process_modules_updates to '1' in app/etc/local.xml and
* then use this script to apply updates and refresh the config cache without
* causing a stampede on the config cache.
*
* @author Colin Mollenhour
*/
umask(0);
ini_set('memory_limit','512M');
#!/usr/bin/php
<?php
if(file_exists('app/Mage.php')) require 'app/Mage.php';
else require '../../app/Mage.php';
Mage::app();
Mage::getModel('core/cache')->flush();
@dsueiro
dsueiro / sm-annotated.html
Created July 5, 2014 10:23 — forked from hdragomir/sm-annotated.html
The deferred font loading logic of smashing magazine
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
<div class="modal hide fade" id="confirm-dialog">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3>Confirm</h3>
</div>
<div class="modal-body">
&nbsp;
</div>
<div class="modal-footer">
<a href="#" class="btn btn-danger">Ok</a>
<?php
function get_flag($value) {
$value = strtolower($value);
return $value === TRUE || ($value !== 'false' && !!$value);
}
$modules_dir = dir('app/etc/modules/');
$rewrites = array();
$conflicts = array();
@dsueiro
dsueiro / gist:5406417
Created April 17, 2013 18:02 — forked from anonymous/gist:3842009
Every prepareCollection
File: Adminhtml/Block/Api/Grid/Role.php
function _prepareCollection()
{
$collection = Mage::getModel("api/roles")->getCollection();
$this->setCollection($collection);
return parent::_prepareCollection();
}
+--------------------------------------------------+
File: Adminhtml/Block/Api/Role/Grid/User.php