Skip to content

Instantly share code, notes, and snippets.

@Phize
Phize / SassMeister-input.scss
Created July 2, 2014 11:08
Generated by SassMeister.com.
// ----
// Sass (v3.3.9)
// Compass (v1.0.0.alpha.20)
// ----
// This is an example to define private mixin(s)/function(s).
// by https://twitter.com/phize
// If this is not a bug, it is a bit useful
// although there are no way to export private mixin(s)/function(s).
@Phize
Phize / SassMeister-input.scss
Created June 25, 2014 11:59
Generated by SassMeister.com.
// ----
// Sass (v3.3.8)
// Compass (v1.0.0.alpha.19)
// ----
// This is an example of building decoupled components with Sass
// by https://twitter.com/phize
// Dependency Injection: mixin injection
// http://sassmeister.com/gist/5122325c0c29889b91c3
@Phize
Phize / SassMeister-input.scss
Created June 25, 2014 01:10
Generated by SassMeister.com.
// ----
// Sass (v3.3.8)
// Compass (v1.0.0.alpha.19)
// ----
// Sass: Type hinting with function.
// by https://twitter.com/phize
// Dependency Injection: @content injection
// http://sassmeister.com/gist/3686b8eb3462fef52013
@Phize
Phize / SassMeister-input.scss
Created June 22, 2014 19:00
Generated by SassMeister.com.
// ----
// Sass (v3.3.8)
// Compass (v1.0.0.alpha.19)
// ----
// An example that injects the dependency into your component.
// by https://twitter.com/phize
// @content injection:
// This simple way cannot define actual dependencies in your components,
@Phize
Phize / SassMeister-input.scss
Created June 22, 2014 14:56
Generated by SassMeister.com.
// ----
// Sass (v3.3.8)
// Compass (v1.0.0.alpha.19)
// ----
// Polymorphic components with Sass.
// by https://twitter.com/phize
//
// Dependency Injection: http://sassmeister.com/gist/5122325c0c29889b91c3
// More simple DI: http://sassmeister.com/gist/3686b8eb3462fef52013
@Phize
Phize / SassMeister-input.scss
Created June 21, 2014 09:36
Generated by SassMeister.com.
// ----
// Sass (v3.3.8)
// Compass (v1.0.0.alpha.19)
// ----
// An example that injects the dependency into a mixin.
// by https://twitter.com/phize
// More simple way: @content injection
// http://sassmeister.com/gist/3686b8eb3462fef52013
@Phize
Phize / get_template_part.php
Last active December 27, 2015 13:39
WordPress: passing arguments to get_template_part() #wp
<?php
function my_get_template_part( $slug, $name = null, $vars = [] ) {
do_action( 'get_template_part_' . $slug, $slug, $name );
$templates = [];
$name = (string) $name;
if ( $name !== '' ) {
$templates[] = $slug . '-' . $name . '.php';
}
@Phize
Phize / feednews.php
Created April 29, 2012 12:56
PHPTAL: a PHPTALES to check if a value exists and is not empty string.
function phptal_tales_notEmpty($src, $nothrow) {
$src = trim($src);
if (ctype_alnum($src)) return 'isset($ctx->' . $src . ') && "" !=== $ctx->' . $src;
return '(null !== ($path = $ctx->path($ctx,' . PHPTAL_Php_TalesInternal::string($src) . ', true)) && "" !== $path)';
}
@Phize
Phize / gist:2218076
Created March 27, 2012 17:13
Bash function to get Git repository' basename.
function git_repository_basename() {
local _repository_basename
if [ $(git rev-parse --is-bare-repository) = 'true' ]; then
_repository_basename=$(basename $(git rev-parse --show-toplevel))
_repository_basename=${_repository_basename%.git}
else
_repository_basename=$(basename $(readlink -nf $(git rev-parse --show-toplevel)))
fi
@Phize
Phize / .vimrc_local
Created February 2, 2012 09:05
Vim: switching github accounts for Gist.vim
" **************************************************
" Gist {{{
" **************************************************
" dictionary of Gist accounts.
let g:gist_accounts = {
\ 'user1': {
\ 'password': 'password'
\ },
\ 'user2': {
\ 'password': 'password'