Skip to content

Instantly share code, notes, and snippets.

@danyeah
danyeah / current-template.php
Last active August 29, 2015 14:14
Wordpress current template
// Outputs the template used
// Usage: echo get_current_template(true);
// Credits: http://www.kevinleary.net/get-current-theme-template-filename-wordpress/
function define_current_template( $template ) {
$GLOBALS['current_theme_template'] = basename($template);
return $template;
}
function get_current_template( $echo = false ) {
@danyeah
danyeah / gist:67dec22f48ad590494ff
Last active August 29, 2015 14:14
Preferences.sublime-settings
{
"bold_folder_labels": true,
"caret_extra_width": 1,
"caret_style": "phase",
"close_windows_when_empty": false,
"color_scheme": "Packages/User/SublimeLinter/predawn (SL).tmTheme",
"copy_with_empty_selection": false,
"drag_text": false,
"draw_minimap_border": true,
"enable_tab_scrolling": true,
@danyeah
danyeah / gist:1322d5cdbe574318c975
Last active January 8, 2016 10:21
user.sublime-keymap
[
{ "keys": ["ctrl+shift+u"], "command": "sftp_upload_file" },
{ "keys": ["pause"], "command": "sftp_cancel_upload" },
{ "keys": ["f1"], "command": "show_panel", "args": {"panel": "console", "toggle": true} },
{ "keys": ["ctrl+shift+r"], "command": "reindent" , "args": {"single_line": false}},
{ "keys": ["ctrl+super+k"], "command": "toggle_comment", "args": { "block": true } },
{ "keys": ["ctrl+alt+k"], "command": "insert_snippet", "args": {"name": "Packages/User/comment.sublime-snippet"} },
{ "keys": ["shift+f3"], "command": "css_sorter" },
{ "keys": ["ctrl+alt+f"], "command": "use_it" },
{ "keys": ["alt+e"], "command": "insert_snippet", "args": {"contents": "<em>${0:$SELECTION}</em>" } },
@danyeah
danyeah / animationFrame.js
Last active August 29, 2015 14:13
Animation Frame with polyfill
window.animFrame = (function(){
return window.requestAnimationFrame||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function( callback ){
window.setTimeout(callback, 15);
};
})();
var scrollTimeout;
$(window).scroll(function () {
@danyeah
danyeah / ground_excerpt.php
Created January 8, 2015 10:32
Wordpress custom excerpt
/* ==========================================================================
13 - Excerpt custom lenght : ground_excerpt( 100, __('Read more', 'ground'), '...', 'classname' );
* ========================================================================== */
// Summary or description of a post with custom lenght
$word = __('Read more', 'ground');
function ground_excerpt( $character_length = 100, $word, $continue = '...', $class="button" ) {
@danyeah
danyeah / vertical-rhythm.scss
Last active August 29, 2015 14:08
Vertical Rhythm
/*
* This is a port of Compass rhythm function
* To do: add other parameters
* $font-base and $line-height variables should be set according to your vertical rhythm
*/
@function rhythm($lines: 1, $font-size: $font-base, $offset: 0) {
$rhythm: $lines * $line-height;
@if unit($rhythm) == px {
$rhythm: floor($rhythm);
$(document).ready(function() {
var DEBUG = false;
function formfiller1() {
$("input").add("textarea").not("[type=button], [type=submit]").each(function() {
if ( $(this).hasClass('email')) {
$(this).attr("value" ,"daniel@mail.it");
} else {
$(this).attr("value","test");
}
/*
* Tooltip
* Block: .tooltip
* Elements:
* Modifiers:
*/
.tooltip {
display: inline-block;
position: relative;
@danyeah
danyeah / SassMeister-input.scss
Created March 28, 2014 13:20
Generated by SassMeister.com.
// ----
// Sass (v3.3.4)
// Compass (v1.0.0.alpha.18)
// ----
%widget {
padding: 10px;
h1 {
margin-bottom: 10px;
@danyeah
danyeah / brackets.sublime-macro
Created March 17, 2014 11:15
Sublime macro: { [tab] }
[
{
"args":
{
"characters": " "
},
"command": "insert"
},
{
"args":