Skip to content

Instantly share code, notes, and snippets.

@lakhbawa
lakhbawa / LoadingGoogleMapsMixin.vue
Last active May 10, 2022 19:15
Adding Google Maps to NuxtJs
<script>
const apiKey = process.env.GOOGLE_MAPS_API_KEY
export default {
props: {},
computed: {},
methods: {
injectGoogleMapsApiIfNotInjectedAlready() {
return new Promise((resolve, reject) => {
try {
@RealOrangeOne
RealOrangeOne / README.md
Last active August 31, 2024 19:53
Trello JSON parser

Trello Parser

Download

Open a terminal, run this:

sudo curl https://gist.githubusercontent.com/RealOrangeOne/c35751ee794e90df512bdfba6f22574d/raw/trello-parser.py -o /usr/bin/trelloparse && sudo chmod +x /usr/bin/trelloparse

Usage

$ trelloparse -h

usage: tp [-h] input output

@monkeymonk
monkeymonk / jquery.scrollToTop.js
Created April 8, 2016 08:26
ES6 jQuery plugin definition
import $ from 'jquery';
import plugin from './plugin';
class ScrollToTop {
constructor(element, options) {
const $element = $(element);
$(window).scroll(function () {
if ($(this).scrollTop() > options.offset) {
$element.fadeIn();
@tonymtz
tonymtz / gist:d75101d9bdf764c890ef
Last active July 26, 2024 20:17
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@mmikkel
mmikkel / class.MyPost.php
Created November 11, 2014 10:50
TimberPost extension w/ post slug support
<?php
class MyPost extends TimberPost {
public function __construct( $post_id = null, $post_type = 'post' ) {
if ( is_string( $post_id ) ) {
// If $post_id is a string, we'll consider it a slug and try to get the ID
$args = array(
@romuloctba
romuloctba / functions.php
Created September 24, 2014 04:33
Add all custom fields to JSON REST API wordpress
function json_api_prepare_post( $post_response, $post, $context ) {
$field = get_post_custom($post['ID']);
$post_response['custom-fields'] = $field;
return $post_response;
}
add_filter( 'json_prepare_post', 'json_api_prepare_post', 10, 3 );
@strangerstudios
strangerstudios / pmpro_currencies_ruble.php
Last active April 14, 2021 19:25
Add Russian Ruble to PMPro currencies.
function pmpro_currencies_ruble($currencies)
{
$currencies['RUB'] = __('Russian Ruble (RUB)', 'pmpro');
return $currencies;
}
add_filter('pmpro_currencies', 'pmpro_currencies_ruble');
@al-the-x
al-the-x / notes.md
Created February 7, 2014 19:11
Tips from @rasmus about atomic deployments...

The only way to have atomic (code) deploys:

  • Don't copy files into current document root
  • Let existing requests finish on old code
  • New requests start on new code
  • Avoid clearing your opcode cache
  • Minimal impact on production traffic

Breakdown:

@TomByrne
TomByrne / MultiExporter.jsx
Last active November 14, 2024 16:35
An Illustrator script for exporting layers and/or artboards into separate files (PNG8 / PNG24 / EPS / PDF / SVG / JPG / FXG).See http://www.tbyrne.org/export-illustrator-layers-to-svg-files
// MultiExporter.jsx
// Version 0.1
// Version 0.2 Adds PNG and EPS exports
// Version 0.3 Adds support for exporting at different resolutions
// Version 0.4 Adds support for SVG, changed EPS behaviour to minimise output filesize
// Version 0.5 Fixed cropping issues
// Version 0.6 Added inner padding mode to prevent circular bounds clipping
//
// Copyright 2013 Tom Byrne
// Comments or suggestions to [email protected]
@brasofilo
brasofilo / wpse_76593.php
Last active August 17, 2017 11:38
Hide wp-content/themes path
<?php
// REMOVE WP-CONTENT
// Rewrites DO NOT happen for child themes
// Add .htaccess rewrite rules to convert urls
// like "http://example.com/wp-content/themes/theme-name/path" into "http://example.com/path"
/*
in case your wordpress is in a folder,
and you change the site_url to the root of the domain,
add the folder name in lines 29 to 34,