Skip to content

Instantly share code, notes, and snippets.

@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@thomaspark
thomaspark / bobross.css
Last active March 9, 2020 14:33
Bob Ross’ color palette in CSS
.sap-green {
background-color: #0A3410;
}
.sap-green-text {
color: #0A3410;
}
.sap-green-border {
border-color: #0A3410;
}
@arthurdent
arthurdent / Get-FtpDirectory.ps1
Created April 1, 2015 22:11
Recursively list all files in FTP directory in PowerShell / List files (recursive)
$Server = "ftp://ftp.example.com/"
$User = "anonymous@example.com"
$Pass = "anonymous@anonymous.com"
Function Get-FtpDirectory($Directory) {
# Credentials
$FTPRequest = [System.Net.FtpWebRequest]::Create("$($Server)$($Directory)")
$FTPRequest.Credentials = New-Object System.Net.NetworkCredential($User,$Pass)
$FTPRequest.Method = [System.Net.WebRequestMethods+FTP]::ListDirectoryDetails

I was trying to get my tests as fast as possible like in gary bernhardts videos. I noticed even running the rspec command with no test at all took about 500 ms.

I know there is weird stuff in my .bashrc that takes awhile to load the first shell. But does that slow down every command as well?

🍒tony@moguya ~$ time ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]

real    0m0.504s
user 0m0.041s
@dideler
dideler / upgrade-postgres-9.3-to-9.4.md
Last active June 8, 2020 03:24
Upgrading PostgreSQL from 9.3 to 9.4 when upgrading Ubuntu 14.04 to 14.10

TL;DR

Create a backup:

pg_dumpall > mybackup.sql

Perform the upgrade:

sudo pg_dropcluster 9.4 main --stop
@pwfisher
pwfisher / radio-button-component.js
Last active August 29, 2015 14:07 — forked from courajs/helpers-radio-button.js
radio-button-component.js
// {{ radio-button name='dish' value='spam' groupValue=selectedDish }} Spam
// {{ radio-button name='dish' value='eggs' groupValue=selectedDish }} Eggs
//
App.RadioButtonComponent = Ember.Component.extend({
tagName: 'input',
type: 'radio',
attributeBindings: [ 'checked', 'name', 'type', 'value' ],
checked: function () {
@slindberg
slindberg / if-all-exists.js
Last active August 29, 2015 13:57
Bound conditional Handlebars helpers for Ember
import ifConditionHelper from 'myapp/helpers/if-condition';
/**
* Logical AND Existence Conditional Block
*
* Usage: {{#if-all-exists field1 field2}}Either field1 or field2 is truthy{{/if-all-exists}}
*
* Executes the given block if all arguments are defined
*/
export default function() {
@rosszurowski
rosszurowski / lerp-color.js
Last active March 3, 2023 12:14
Linear interpolation for hexadecimal colors.
/**
* A linear interpolator for hexadecimal colors
* @param {String} a
* @param {String} b
* @param {Number} amount
* @example
* // returns #7F7F7F
* lerpColor('#000000', '#ffffff', 0.5)
* @returns {String}
*/
@jalcine
jalcine / gist:7297333
Created November 4, 2013 02:38 — forked from jittuu/gist:792715
require 'spec_helper'
describe Users::OauthCallbacksController, "handle facebook authentication callback" do
describe "#annonymous user" do
context "when facebook email doesn't exist in the system" do
before(:each) do
stub_env_for_omniauth
get :facebook
@michaelcox
michaelcox / SpecRunner.js
Last active January 11, 2024 06:05
Browser Unit Testing with Backbone Mocha Chai and RequireJS
require.config({
baseUrl: '/backbone-tests/',
paths: {
'jquery' : '/app/libs/jquery',
'underscore' : '/app/libs/underscore',
'backbone' : '/app/libs/backbone',
'mocha' : 'libs/mocha',
'chai' : 'libs/chai',
'chai-jquery' : 'libs/chai-jquery',
'models' : '/app/models'