Skip to content

Instantly share code, notes, and snippets.

View madalinignisca's full-sized avatar
🏡
Open for business

Madalin Ignisca madalinignisca

🏡
Open for business
View GitHub Profile
@madalinignisca
madalinignisca / functions.php
Created February 23, 2014 10:55
WordPress themes function.php recommended things
<?php
// Support for thumbnails on proper media files - activates post thumbnails by default
add_post_type_support( 'attachment:audio', 'thumbnail' );
add_post_type_support( 'attachment:video', 'thumbnail' );
add_theme_support( 'post-thumbnails', array( 'post', 'attachment:audio', 'attachment:video' ) );
@madalinignisca
madalinignisca / deploy.php
Last active August 29, 2015 13:56 — forked from oodavid/README.md
Git deploy script for php projects.
<?php
/**
* GIT DEPLOYMENT SCRIPT
*
* Used for automatically deploying websites via github, gitlab or bitbucket, more deets here:
*
* https://gist.github.com/9323683
*/
// The commands
@madalinignisca
madalinignisca / fbresp.js
Created April 24, 2014 18:01
Facebook responsive with jQuery
$(window).bind("load resize", function(){
var container_width = $('.facebook-block').width();
$('.facebook-block').html('<div class="fb-like-box" ' +
'data-href="https://www.facebook.com/MeraMusik"' +
' data-width="' + container_width + '" data-height="300" data-show-faces="true" ' +
'data-stream="false" data-header="true" data-show-border="false"></div>');
FB.XFBML.parse( );
});
@madalinignisca
madalinignisca / composer
Last active August 29, 2015 14:00
composer on windows scripts for cmd and bash
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
<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);
@madalinignisca
madalinignisca / settings.php
Created April 4, 2015 05:03
Database settings for Drupal 6/7/8 fo use with Docker with linked database
<?php
//...
$databases = array ();
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => getenv('DB_ENV_MYSQL_DATABASE'),
'username' => getenv('DB_ENV_MYSQL_USER'),
@madalinignisca
madalinignisca / phpswitch.sh
Created April 16, 2015 09:57
Homebrew switch PHP version
#!/bin/bash
echo PHP version to unlink
read PHPUNLINK
echo PHP version to link
read PHPLINK
for i in $( brew list | grep $PHPUNLINK ); do
brew unlink $i
@madalinignisca
madalinignisca / hhvm_php.ini
Last active August 29, 2015 14:21 — forked from tektoh/hhvm_php.ini
hhvm for concrete5
; php options
session.save_handler = files
session.save_path = /var/lib/php5
session.gc_maxlifetime = 1440
short_open_tag = Off
expose_php = Off
; hhvm specific
hhvm.log.level = Warning
@madalinignisca
madalinignisca / wp-config-alternate-cron.php
Last active August 29, 2015 14:24
WordPress wp-config.php extra snippets for better performance and security
<?php // Use this when you use normal web cron and scheduled posts don't get published
define( 'ALTERNATE_WP_CRON', true );
@madalinignisca
madalinignisca / backupdb.sh
Created July 10, 2015 14:57
Backup the database from bash, zip it and delete any older then X days. Good to use with Cron when hosting websites.
#!/bin/bash
# replace what is in [[ ]] with necessary variables
# Database credentials
user="[[username]]"
password="[[password]]"
host="[[host]]"
db_name="[[database_name]]"
# Other options
backup_path="[[path_to_backup_folder]]"