Skip to content

Instantly share code, notes, and snippets.

View MaraScott's full-sized avatar
🇪🇺
Maras IT

MaraScott MaraScott

🇪🇺
Maras IT
View GitHub Profile
@geeknam
geeknam / git_history.php
Created May 8, 2011 16:43
Parse git log with PHP to an array
<?php
// Author: Ngo Minh Nam
$dir = "/path/to/your/repo/";
$output = array();
chdir($dir);
exec("git log",$output);
$history = array();
foreach($output as $line){
if(strpos($line, 'commit')===0){
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@JulienBreux
JulienBreux / BlockTags.php
Created April 2, 2012 22:41
PrestaShop 1.5.x - Module override in themes
<?php
/**
* Example of override of Block Tags module
*
* @version 1.0.0
* @author Julien BREUX <julien.breux@prestashop.com>
*/
class BlockTagsTheme extends BlockTags
{
//...
@miloplacencia
miloplacencia / lazyload.js
Created October 22, 2012 14:39
lazyload.js (c) Lorenzo Giuliani
/* lazyload.js (c) Lorenzo Giuliani
* MIT License (http://www.opensource.org/licenses/mit-license.html)
*
* expects a list of:
* `<img src="blank.gif" data-src="my_image.png" width="600" height="400" class="lazy">`
*/
!function(window){
var $q = function(q, res){
if (document.querySelectorAll) {
@gdvalle
gdvalle / putty-monokai.reg
Created December 2, 2012 05:24
Monokai style theme for PuTTY; colors copied from ST2's theme
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\monokai]
"Colour21"="255,255,255"
"Colour20"="245,222,179"
"Colour19"="200,240,240"
"Colour18"="0,217,217"
"Colour17"="179,146,239"
"Colour16"="174,129,255"
"Colour15"="122,204,218"
$app->match('/export', function() use($app){
$sql = 'SELECT * FROM partial_customers';
$records = $app['db']->fetchAll($sql);
header("Content-Type: text/csv");
header("Content-Disposition: attachment; filename=partial_customers.csv");
header("Pragma: no-cache");
header("Expires: 0");
$output = fopen("php://output", "w");
@xeoncross
xeoncross / clean_html.php
Created March 8, 2013 17:28
Sanitize HTML using PHP and the DOMDocument
<?php
/**
* Clean HTML string removing all element attributes and elements which are
* not in the provided whitelist (but keeping their allowed children).
*
* @see https://github.com/alixaxel/phunction/blob/master/phunction/HTML.php
* @param string $html to clean
* @param array $whitelist
*/
function clean_html($html, array $whitelist)
@MartijnR
MartijnR / jquery.getXPath.js
Created March 8, 2013 19:00
Get XPath from jQuery element
/**
* Creates an XPath from a node (currently not used inside this Class (instead FormHTML.prototype.generateName is used) but will be in future);
* @param {string=} rootNodeName if absent the root is #document
* @return {string} XPath
*/
$.fn.getXPath = function(rootNodeName){
//other nodes may have the same XPath but because this function is used to determine the corresponding input name of a data node, index is not included
var position,
$node = this.first(),
nodeName = $node.prop('nodeName'),
@msurguy
msurguy / List.md
Last active April 30, 2024 15:14
List of open source projects made with Laravel

Other people's projects:

My projects (tutorials are on my blog at http://maxoffsky.com):

@zackkatz
zackkatz / plugin-activation-functions.php
Last active March 21, 2019 14:44
Functions to get plugin activation and deactivation links
<?php
/**
* Get the Activation URL for a plugin
* @param string $plugin_path Directory and file name of plugin, like: `hello-dolly/hello.php`
* @return string URL to activate the plugin
*/
function get_plugin_activation_link( $plugin_path = 'hello-dolly/hello.php' ) {
return wp_nonce_url(admin_url('plugins.php?action=activate&amp;plugin='.$plugin_path), 'activate-plugin_'.$plugin_path);
}