Skip to content

Instantly share code, notes, and snippets.

View Akamaozu's full-sized avatar

Uzo Olisemeka Akamaozu

View GitHub Profile
@jt
jt / merge.md
Created August 23, 2011 18:47
Merge a forked gist

If someone forks a gist and you'd like to merge their changes. Do this:

  1. clone your repo, I use the name of the gist

     git clone git://gist.github.com/1163142.git gist-1163142
    
  2. add a remote for the forked gist, I'm using the name of my fellow developer

     git remote add aaron git://gist.github.com/1164196.git
    
@luetkemj
luetkemj / wp-query-ref.php
Last active May 25, 2024 10:56
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@chad3814
chad3814 / gist:2924672
Last active January 16, 2024 20:27
deleting array items in javascript with forEach() and splice()
// This is from my comment here: http://wolfram.kriesing.de/blog/index.php/2008/javascript-remove-element-from-array/comment-page-2#comment-466561
/*
* How to delete items from an Array in JavaScript, an exhaustive guide
*/
// DON'T use the delete operator, it leaves a hole in the array:
var arr = [4, 5, 6];
delete arr[1]; // arr now: [4, undefined, 6]
@jhurliman
jhurliman / stacktrace.php
Created July 20, 2012 00:03
Pretty print stack trace in PHP
function stackTrace() {
$stack = debug_backtrace();
$output = 'Stack trace:' . PHP_EOL;
$stackLen = count($stack);
for ($i = 1; $i < $stackLen; $i++) {
$entry = $stack[$i];
$func = $entry['function'] . '(';
$argsLen = count($entry['args']);
@hiroakis
hiroakis / example_rabbitmq_api.py
Last active August 21, 2023 13:33
Calling the RabbitMQ api from Python sample
#!/usr/local/bin/python
import requests
import json
def call_rabbitmq_api(host, port, user, passwd):
url = 'http://%s:%s/api/queues' % (host, port)
r = requests.get(url, auth=(user,passwd))
return r
@wolever
wolever / notice_board.py
Last active August 29, 2015 14:04
What I'm currently calling the "Notice Board pattern". Is this already a thing?
"""
The Notice Board pattern: returns the most recent value associated with a key,
or blocks waiting for a new value if the current value has already been seen.
History is not stored; only the most recent value is available.
The physical analogy is a notice board like you might see at a train station:
when you arrive at the station you can glance at the board to check the current
departure time for your train, or you can stand around watching the board
waiting for the inevitable message that your train has been delayed.
@joshcanhelp
joshcanhelp / scrollTo.js
Last active January 28, 2022 13:21
Animated scrollTo for specific element or top of page
//
// Smooth scroll-to inspired by:
// http://stackoverflow.com/a/24559613/728480
//
module.exports = function (scrollTo, scrollDuration) {
//
// Set a default for where we're scrolling to
//
@dvdbng
dvdbng / vim-heroku.sh
Last active June 18, 2024 19:22
Run vim in heroku updated 2017
mkdir ~/vim
cd ~/vim
# Staically linked vim version compiled from https://github.com/ericpruitt/static-vim
# Compiled on Jul 20 2017
curl 'https://s3.amazonaws.com/bengoa/vim-static.tar.gz' | tar -xz
export VIMRUNTIME="$HOME/vim/runtime"
export PATH="$HOME/vim:$PATH"
cd -
@dancameron
dancameron / functions.php
Created May 22, 2018 15:47
Adding new Currency Local (Example: Naira)
<?php // don't include this line in your functions.php, since it already starts with it.
function _si_add_local_for_client( $client_fields = array() ) {
$client_fields['money_format']['options']['ngn'] = 'Naira';
return $client_fields;
}
add_filter( 'si_client_adv_form_fields', '_si_add_local_for_client' );
function _si_set_localeconv( $localeconv = array(), $locale = '' ) {
switch ( $locale ) {