Skip to content

Instantly share code, notes, and snippets.

View rinatkhaziev's full-sized avatar
🤖
Cache rules everything around me

Rinat K rinatkhaziev

🤖
Cache rules everything around me
View GitHub Profile
@minwe
minwe / EventSystem.js
Last active October 22, 2019 03:03 — forked from yitsushi/EventSystem.js
Global event system for React.js
var EventSystem = (function() {
var self = this;
self.queue = {};
return {
publish: function (event, data) {
var queue = self.queue[event];
if (typeof queue === 'undefined') {
on alfred_script(q)
tell application "Sequel Pro" to quit
tell application "Dash" to quit
tell application "Tower" to quit
tell application "iTerm" to quit
tell application "Sublime Text 2" to quit
end alfred_script

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@ihorvorotnov
ihorvorotnov / get-social-shares
Last active October 20, 2020 12:15
Get number of shares from social platforms
Facebook*:
https://api.facebook.com/method/links.getStats?urls=%%URL%%&format=json
+ works, returns shares, likes, comments and total
Twitter:
http://urls.api.twitter.com/1/urls/count.json?url=%%URL%%&callback=twttr.receiveCount
+ v1 API but still works
Reddit:
http://buttons.reddit.com/button_info.json?url=%%URL%%
@Viper007Bond
Viper007Bond / whatissoslow.php
Last active October 29, 2023 14:23
WordPress: Times how long it takes each filter and action to run and displays results at the end of the page. Quick and dirty.
<?php
/**
* This little class records how long it takes each WordPress action or filter
* to execute which gives a good indicator of what hooks are being slow.
* You can then debug those hooks to see what hooked functions are causing problems.
*
* This class does NOT time the core WordPress code that is being run between hooks.
* You could use similar code to this that doesn't have an end processor to do that.
*
@nb
nb / class-query-iterator.php
Created November 12, 2012 15:34
WordPress Chunk Query Iterators
<?php
/**
* Iterates over results of a query, split into many queries via LIMIT and OFFSET
*/
class QueryIterator implements Iterator {
var $limit = 500;
var $query = '';
var $global_index = 0;
@Viper007Bond
Viper007Bond / gist:3832072
Created October 4, 2012 07:57
WordPress.com's watermarker plugin
<?php
/*
* Plugin Name: WordPress.com Watermark Image Uploads
* Description: Applies a watermark image of your choosing to all uploaded images.
* Author: Alex Mills
* Author URI: http://automattic.com/
*/
class WPcom_Watermark_Uploads {
@snowman-repos
snowman-repos / gist:3825198
Created October 3, 2012 05:28
JavaScript: Detect Orientation Change on Mobile Devices
// Listen for orientation changes
window.addEventListener("orientationchange", function() {
// Announce the new orientation number
alert(window.orientation);
}, false);
// Listen for resize changes
window.addEventListener("resize", function() {
// Get screen size (inner/outerWidth, inner/outerHeight)
@mjangda
mjangda / jetpack-loader.php
Created August 31, 2012 05:11
Manually load Jetpack modules (e.g. for dev or offline environments); drop this in your mu-plugins folder
<?php
// TODO: don't run if Jetpack is active
add_action( 'plugins_loaded', function() {
if ( ! file_exists( WP_PLUGIN_DIR . '/jetpack/' ) )
return;
$modules = array(
'modules/contact-form.php',
'modules/shortcodes.php',