Skip to content

Instantly share code, notes, and snippets.

View daverogers's full-sized avatar
🤘

Dave Rogers daverogers

🤘
View GitHub Profile
@eddyerburgh
eddyerburgh / vue-test-utils-overview.js
Last active April 8, 2022 11:05
vue-test-utils hasClass example
import { mount } from 'vue-test-utils'
import Component from '@/components/ComponentToTest'
const wrapper = mount(ComponentToTest)
// Traversal
const Foo = wrapper.find(Foo)
const divs = wrapper.findAll('div')
const div = divs.at(0)
@s0undt3ch
s0undt3ch / cassandra.service
Created September 18, 2015 14:01
CentOS 7 Cassandra systemd service file
# /usr/lib/systemd/system/cassandra.service
[Unit]
Description=Cassandra
After=network.target
[Service]
PIDFile=/var/run/cassandra/cassandra.pid
User=cassandra
Group=cassandra
@z3cka
z3cka / Vagrantfile
Created December 5, 2013 17:44
Sample base Vagrantfile with 2GB of ram and 2 cpus :-) Initialize with: vagrant init precise32 http://files.vagrantup.com/precise32.box
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise32"
@jakob-stoeck
jakob-stoeck / Copy as textile
Created October 29, 2013 17:52
Copies SequelPro results as a textile table to use it in Redmine or other textile-supported systems. To use, just copy it into your SequelPro Bundle Editor.
#!/usr/bin/php
<?php
$in = fopen('php://stdin', 'r');
$result=array();
$format='_.';
while($line=fgetcsv($in, 0, "\t")) {
$result[]='|'.$format.implode('|'.$format, $line).'|';
$format='';
}
fclose($in);
@jakeasmith
jakeasmith / mysqldump.sh
Last active June 28, 2021 20:07
A quick snippet for doing a compressed mysql dump with a pv to monitor progress
mysqldump [database] | pv | gzip -c > [file].sql.gz
@06b
06b / PutCursorAtEnd.js
Created March 14, 2013 17:55
Put the cursor at the end of a textbox
// jQuery plugin: PutCursorAtEnd 1.0
// http://plugins.jquery.com/project/PutCursorAtEnd
// by teedyay
//
// Puts the cursor at the end of a textbox/ textarea
// codesnippet: 691e18b1-f4f9-41b4-8fe8-bc8ee51b48d4
(function($)
{
jQuery.fn.putCursorAtEnd = function()
{
@varemenos
varemenos / getparam.js
Created April 29, 2012 03:50 — forked from alkos333/gist:1771618
JQuery - GET URL Parameter value
// Given a query string "?to=email&why=because&first=John&Last=smith"
// getUrlVar("to") will return "email"
// getUrlVar("last") will return "smith"
// Slightly more concise and improved version based on http://www.jquery4u.com/snippets/url-parameters-jquery/
function getUrlVar(key){
var result = new RegExp(key + "=([^&]*)", "i").exec(window.location.search);
return result && unescape(result[1]) || "";
}
@mrclay
mrclay / firstLast.sql
Created April 3, 2012 14:02
MySQL: Extract last and first name(s) from a full "name" field (for Elgg)
SELECT
-- Assumed to be trimmed
name
-- Does name contain multiple words?
,(LOCATE(' ', name) = 0) AS hasMultipleWords
-- Returns the end of the string back until reaches a space.
-- E.g. "John Doe" => "Doe"
-- E.g. "Francis Scott Key" => "Key"