This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /usr/lib/systemd/system/cassandra.service | |
[Unit] | |
Description=Cassandra | |
After=network.target | |
[Service] | |
PIDFile=/var/run/cassandra/cassandra.pid | |
User=cassandra | |
Group=cassandra |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysqldump [database] | pv | gzip -c > [file].sql.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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]) || ""; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |