Skip to content

Instantly share code, notes, and snippets.

View kriskhaira's full-sized avatar

Kris Khaira kriskhaira

View GitHub Profile
@kriskhaira
kriskhaira / checkdns
Created November 28, 2010 16:14
Useful for checking DNS propagation with Google Public DNS and OpenDNS after migrating servers
#!/bin/bash
# checkdns
# A very simple dig tool for checking DNS propagation with Google Public DNS and OpenDNS after migrating servers
#
# INSTRUCTIONS
# Put this in your ~/bin folder, make it executable and run it by typing "checkdns" in your command line
read -p "Enter domain: " domain
# Google Public DNS
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA4XW7oM/qXd8R+3v8Z5+HbjFQ3/Crn140yBWZ8rqXcuwN2In3n6052JqG8F5KloalXjDdhon1eIiLXxfGVU/kR/Zy7IPbY4eR5pwNhTMtOxeLuMmTUNqICQIf2GXEeNHBrwYQW/psG/w67N4x/20/GQKX3LPEFprN5NkmVUvscdWCmmlvPRTdj5tl47SvWnpqvsM6lUqNe8CfQ895Iw8bkccKBx4wW7/kDHO/3q+V0cqQDxsbe3E28QC4ZEb+zkeYkwSw88MUh3v5EHBgwzit3RHxvbCQOQ/LT29FXeoN7diRT4fYbxmtACRnbTyB9vgI9kaUSCymgma1eACJlNCedw== kris@kris-ubuntudeskv
@kriskhaira
kriskhaira / no-www
Created November 7, 2011 09:41
To redirect all users to access the site WITHOUT the 'www.' prefix
# 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]
@kriskhaira
kriskhaira / ember-view-jade-1
Created October 10, 2012 03:31
JADE for Ember view 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 / .gitignore
Last active March 25, 2019 23:20
My usual .gitignore template
#----------------------------------------------------------------------------
# EMBER-CLI DEFAULT
#----------------------------------------------------------------------------
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
# dependencies
@kriskhaira
kriskhaira / hide-facebook-stream.user.js
Last active May 6, 2018 23:02
Hide Facebook Stream - Tampemonkey Script
// ==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 / controllers.application.js
Created June 28, 2016 20:48
Concatenating words - Ember.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 / scopes-rspec.rb
Last active March 9, 2017 14:23
testing scopes in RSpec
# 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 / searchAndRunSpecs.sh
Last active March 30, 2017 18:01
Run RSpec on all lines of files matching a phrase. Use case: making sure tests are working after refactoring.
# 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 / gsite.sh
Last active November 22, 2017 09:35 — forked from whobutsb/github_repo.sh
Shell script to open the current GitHub or GitLab project URL
# 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