Skip to content

Instantly share code, notes, and snippets.

Kris Khaira kriskhaira

Block or report user

Report or block kriskhaira

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:e1f1378dd77930012ad30ef1bde63950
+---------------------------------------+-------+--------+-------+------------+---------+
| CONCAT(table_schema, '.', table_name) | rows | DATA | idx | total_size | idxfrac |
+---------------------------------------+-------+--------+-------+------------+---------+
| buybackexpress.not_purchasing_item | 9.25M | 31.03G | 1.33G | 32.35G | 0.04 |
| buybackexpress.tmp_order | 0.87M | 13.57G | 0.33G | 13.90G | 0.02 |
| buybackexpress.quote_log | 5.70M | 9.84G | 0.07G | 9.91G | 0.01 |
| buybackexpress.order_offers | 0.80M | 0.74G | 0.12G | 0.86G | 0.16 |
| buybackexpress.mws_cache_data | 1.24M | 0.30G | 0.15G | 0.46G | 0.50 |
+---------------------------------------+-------+--------+-------+------------+---------+
@kriskhaira
kriskhaira / gsite.sh
Last active Nov 22, 2017 — forked from whobutsb/github_repo.sh
Shell script to open the current GitHub or GitLab project URL
View gsite.sh
# Opens the current GitHub or GitLab project URL
#
# Based on work by:
#
# whobutsb (Twitter: @SteveBarbera)
# https://gist.github.com/whobutsb/71ec536858957b6010d862f08ccc38f3
#
# ShaydeNofziger (Twitter: @TheMindOfShayde)
# https://dev.to/shayde/open-the-github-project-page-of-a-repo-from-terminal
# https://twitter.com/ThePracticalDev/status/854380399937638400
@kriskhaira
kriskhaira / searchAndRunSpecs.sh
Last active Mar 30, 2017
Run RSpec on all lines of files matching a phrase. Use case: making sure tests are working after refactoring.
View searchAndRunSpecs.sh
# Searches and prints only the filenames with line number, colon-separated
function searchAndOutputNameAndLineOnly {
ag --nogroup $1 $2 | cut -d" " -f1-2 | cut -d":" -f1-2
}
# Searches phrase in path and runs RSpec on the lines
# Usage: searchAndRunSpecs <phrase> <path>
# From https://gist.github.com/kriskhaira/9e706af0bddb49b7d0796ceb467fd95e
function searchAndRunSpecs {
# Gets file list
@kriskhaira
kriskhaira / scopes-rspec.rb
Last active Mar 9, 2017
testing scopes in RSpec
View scopes-rspec.rb
# PATTERN 1: describe > let + before + specify > expect
describe 'scopes' do
let(:offers) { create_list(:offer, 3, :available, :published, :shown) }
before do
offers.first.update(is_published: false)
offers.second.update(is_shown: false)
end
@kriskhaira
kriskhaira / controllers.application.js
Created Jun 28, 2016
Concatenating words - Ember.js
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
fullName: Ember.computed(function() {
let one = "Jason ";
let two = undefined;
let three = ' ';
let four = "";
@kriskhaira
kriskhaira / hide-facebook-stream.user.js
Last active May 6, 2018
Hide Facebook Stream - Tampemonkey Script
View hide-facebook-stream.user.js
// ==UserScript==
// @name Hide Facebook Stream
// @namespace https://gist.github.com/kriskhaira/231b8560168fed899a97
// @version 0.2.0
// @description -
// @author kriskhaira
// @match https://*.facebook.com
// @match https://*.facebook.com/?*
// @grant none
// @require http://code.jquery.com/jquery-latest.js
@kriskhaira
kriskhaira / .gitignore
Last active Mar 25, 2019
My usual .gitignore template
View .gitignore
#----------------------------------------------------------------------------
# EMBER-CLI DEFAULT
#----------------------------------------------------------------------------
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
# dependencies
@kriskhaira
kriskhaira / ember-view-jade-1
Created Oct 10, 2012
JADE for Ember view 1
View ember-view-jade-1
script(type="text/x-handlebars")
{{#view Cashier.transactionRowView}}
table
tbody
{{#each Cashier.transactionsController}}
<tr>
<td>{{datetime}}</td>
<td>{{userId}}</td>
<td>{{amount}}</td>
<td>{{console.datetime}}</td>
@kriskhaira
kriskhaira / no-www
Created Nov 7, 2011
To redirect all users to access the site WITHOUT the 'www.' prefix
View no-www
# NO WWW - taken from Drupal 7's .htaccess
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# --------------------------------------------------------------------------------------------------
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]
View sshkey-kris@kris-ubuntudeskv
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA4XW7oM/qXd8R+3v8Z5+HbjFQ3/Crn140yBWZ8rqXcuwN2In3n6052JqG8F5KloalXjDdhon1eIiLXxfGVU/kR/Zy7IPbY4eR5pwNhTMtOxeLuMmTUNqICQIf2GXEeNHBrwYQW/psG/w67N4x/20/GQKX3LPEFprN5NkmVUvscdWCmmlvPRTdj5tl47SvWnpqvsM6lUqNe8CfQ895Iw8bkccKBx4wW7/kDHO/3q+V0cqQDxsbe3E28QC4ZEb+zkeYkwSw88MUh3v5EHBgwzit3RHxvbCQOQ/LT29FXeoN7diRT4fYbxmtACRnbTyB9vgI9kaUSCymgma1eACJlNCedw== kris@kris-ubuntudeskv
You can’t perform that action at this time.