Skip to content

Instantly share code, notes, and snippets.

@faisalman
faisalman / print_r.js
Last active September 13, 2021 02:57
PHP-like print_r() & var_dump() equivalent for JavaScript
/**
* PHP-like print_r() equivalent for JavaScript Object
*
* @author Faisalman <fyzlman@gmail.com>
* @license http://www.opensource.org/licenses/mit-license.php
* @link http://gist.github.com/879208
*/
var print_r = function (obj, t) {
// define tab spacing
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 27, 2024 16:01
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@probonopd
probonopd / Send infrared commands from the Arduino to the iRobot Roomba
Created March 17, 2013 10:42
Send infrared commands from the Arduino to the iRobot Roomba. Use a transistor to drive the IR LED from pin D3 for maximal range.
#include <IRremote.h>
/*
Send infrared commands from the Arduino to the iRobot Roomba
by probono
2013-03-17 Initial release
@6174
6174 / Random-string
Created July 23, 2013 13:36
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@barneycarroll
barneycarroll / README.md
Last active August 29, 2022 12:02
Lock and unlock a page's scroll position.

jquery.scrollLock.js

Useful for when a blocking user experience is needed (in my case, didn't want people unwittingly loosing their place by scrolling while a modal required their attention): $.scrollLock() locks the body in place, preventing scroll until it is unlocked.

// Locks the page if it's currently unlocked
$.scrollLock();

// ...or vice versa
@DWboutin
DWboutin / Merge wp_query
Created February 7, 2014 14:17
Merge 2 WP_Query()
<?php
$query1 = new WP_Query($arg1);
$query2 = new WP_Query($arg2);
$query = new WP_Query();
$query->posts = array_merge( $query1->posts, $query2->posts );
// we also need to set post count correctly so as to enable the looping
@zacharytamas
zacharytamas / gist:082e538784ebe07e40f9
Created June 13, 2014 19:24
Override window.location
(function () {
var _window = window;
(function () {
var window = {};
Object.defineProperty(window, 'location', {
get: function () { return _window.location; },
@Deevad
Deevad / wacom.sh
Last active October 10, 2022 10:49
A bash script for an advanced setup of a Wacom on Linux : with a grep, automatic parsing of the Wacom identifier, of the screen, of dpi and with a precision mode ( drawing at 1:1 scale , the tablet / the screen ) . Only the button layout remain custom to the model ( Intuos 3 in this example ) and can be easily adapted with other buttons ID.
#! /bin/bash
# A bash script for an advanced setup of a Wacom on Linux :
# with a grep, automatic parsing of the Wacom identifier, of the screen, of dpi and with a precision mode
# ( drawing at 1:1 scale , the tablet / the screen ) .
# Only the button layout remain custom to the model ( Intuos 3 in this example )
# and can be easily adapted with other buttons ID.
#
# Dependencies: libwacom (xsetwacom), Bash and bc for the math, xrandr
# optional: Gnome icon, notify-send
# ( tested/created on Mint 17.2 Cinnamon, 11/2015 )
@lukas-h
lukas-h / license-badges.md
Last active July 27, 2024 13:38
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • The badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.

Translations: (No guarantee that the translations are up-to-date)

@ewistrand
ewistrand / wp-tags-to-search.php
Created February 25, 2016 13:21
Add tags to wordpress search
<?php
// ADD Tags To SEARCH
function my_smart_search( $search, &$wp_query ) {
global $wpdb;
if ( empty( $search ))
return $search;
$terms = $wp_query->query_vars[ 's' ];
$exploded = explode( ' ', $terms );