Skip to content

Instantly share code, notes, and snippets.

View flacoman91's full-sized avatar

Richard Dinh flacoman91

  • EY
  • New York, NY
View GitHub Profile
@titenkov
titenkov / vim-visual-blocks.md
Last active October 24, 2024 15:12
Use Vim visual blocks during interactive git rebase

Sometimes, when rebasing interactively with git, we need to squash a sequence of commits in a branch.

For example, we need to transform this:

pick 0253dc894f bumped
pick 5a1e86933c remove dependency
pick bffoffb395 memberships rpc resource
pick 222fabf5e0 rpc membership service
pick 726a2f9a10 remove crypto logic
@JeffreyMFarley
JeffreyMFarley / jasmine-custom-dictionary-log.js
Last active June 29, 2018 15:07
Who's changing my values?
jasmine.addCustomEqualityTester( ( a, b ) => {
const ak = Object.keys( a ).concat( Object.keys( b ) );
const unique = ak.filter( ( v, i, arr ) => arr.indexOf( v ) === i );
unique.sort();
for ( var i = 0; i < unique.length; i++ ) {
const k = unique[i];
if ( b[k] ) {
console.log( k, '\t', a[k], '\t', b[k] );
}
@chrisjimallen
chrisjimallen / docker-compose.yaml
Created March 3, 2017 18:40
Browsersync working in docker container.
version: '2'
services:
wordpress:
image: wordpress
expose:
- 80
environment:
WORDPRESS_DB_PASSWORD: example
@JeffreyMFarley
JeffreyMFarley / dups.sh
Last active August 25, 2020 14:17
Find Duplicated Javascript code
#!/bin/sh
files=frontend/src/static/js
pmd cpd --language ecmascript --minimum-tokens 25 --files "$files" --format csv \
| sed "1s/.*/lines,tokens,occurrences,L1,F1,L2,F2,L3,F3,L4,F4/" \
| sed "s|$(pwd)/$files|.|g" \
> dups.csv
// ==UserScript==
// @name Auto Check-In to Southwest Flights
// @namespace http://www.ryanizzo.com/southwest-auto-check-in/
// @version 1.5.1
// @author Nicholas Buroojy (http://userscripts.org/users/83813)
// @contributor Ryan Izzo (http://www.ryanizzo.com)
// @contributor JR Hehnly (http://www.okstorms.com @stormchasing)
// @description Automatically check in to Southwest Airline flights at the appropriate time.
// @include https://southwest.com/flight/retrieveCheckinDoc.html*
// @include https://southwest.com/flight/selectPrintDocument*
@helderco
helderco / db-open
Created October 6, 2015 14:51
Script to open a mysql database in Sequel Pro from a service in docker-compose.
#!/bin/bash
set -e
show_help() {
cat << EOF
Usage: ${0##*/} [-u USER] [-p PASS] [-P PORT] [-H HOST] [DATABASE]
${0##*/} -h
Open a standard connection in Sequel PRO.
@josephabrahams
josephabrahams / socialSharePopups.js
Last active November 29, 2021 19:39
Facebook & Twitter Share Popup Windows
(function($) {
$('.js-share-twitter-link').click(function(e) {
e.preventDefault();
var href = $(this).attr('href');
window.open(href, "Twitter", "height=285,width=550,resizable=1");
});
$('.js-share-facebook-link').click(function(e) {
e.preventDefault();
var href = $(this).attr('href');
window.open(href, "Facebook", "height=269,width=550,resizable=1");
@tmsss
tmsss / ctools modal handlers
Created November 12, 2013 21:54
Binding ctools modal handlers dynamically without page reload from http://www.nextide.ca/node/672
$('area.ctools-use-modal, a.ctools-use-modal').each( function() {
var $this = $(this);
$this.unbind(); // Note the unbind: Otherwise there are multiple bind events which causes issues
$this.click(Drupal.CTools.Modal.clickAjaxLink);
// Create a drupal ajax object
var element_settings = {};
if ($this.attr('href')) {
element_settings.url = $this.attr('href');
element_settings.event = 'click';
element_settings.progress = {
@roborourke
roborourke / add_feed.php
Last active April 11, 2022 22:47
add_feed() example for WordPress
<?php
class custom_feed {
public $feed = 'custom-xml';
public function __construct() {
add_action( 'init', array( $this, 'init' ) );
@AKTed
AKTed / wp-reset-roles.php
Last active July 3, 2022 09:45
The following code will reset a WordPress default role to it's default capabilities. Note: these defaults are for WordPress 3.5, any other versions might have different defaults. To be safe, only use this code on WordPress 3.5. Warning: This cannot be undone! The role, in it's current state, is removed and recreated with the WordPress default ro…
<?php
/*
* example usage: $results = reset_role_WPSE_82378( 'subscriber' );
* per add_role() (WordPress Codex), $results "Returns a WP_Role object
* on success, null if that role already exists."
*
* possible $role values:
* 'administrator'
* 'editor'
* 'author'