Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@webdev1001
webdev1001 / _README.md
Created February 24, 2016 16:13 — forked from shime/_README.md
comparing dates and times in RSpec

What is this?

How do you compare date/times in RSpec?

If you do this

expect(Time.now.to_i).to eq Time.new(2014, 4, 2).to_i
@webdev1001
webdev1001 / migrate_postgresql_database.md
Created December 20, 2015 22:30 — forked from olivierlacan/migrate_postgresql_database.md
How to migrate a Homebrew-installed PostgreSQL database to a new major version (9.3 to 9.4) on OS X

This guide assumes that you recently run brew upgrade postgresql and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.

First let's check something.

brew info postgresql

The top of what gets printed as a result is the most important:

@webdev1001
webdev1001 / docx2md.md
Created December 13, 2015 16:55 — forked from vdavez/docx2md.md
Convert a Word Document into MD

Converting a Word Document to Markdown in Two Moves

The Problem

A lot of important government documents are created and saved in Microsoft Word (*.docx). But Microsoft Word is a proprietary format, and it's not really useful for presenting documents on the web. So, I wanted to find a way to convert a .docx file into markdown.

The Solution

As it turns out, there are several open-source tools that allow for conversion between file types. Pandoc is one of them, and it's powerful. In fact, pandoc's website says "If you need to convert files from one markup format into another, pandoc is your swiss-army knife." But, although pandoc can convert from markdown into .docx, it doesn't work in the other direction.

<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@webdev1001
webdev1001 / The difference between the junior and senior Rails developer
Created October 20, 2015 02:12 — forked from njonsson/The difference between the junior and senior Rails developer
The difference between the junior and senior Rails developer — an extract of the discussion forum at the Rubyists LinkedIn group
Someone recently asked the following question in the discussion forum of the Rubyists LinkedIn group: What separates a junior Rails developer from a senior one?
My response follows. Join us at http://www.linkedin.com/groups?gid=120725 to weigh in on this and other topics of interest to Rubyists. As of today there are almost 1,200 members, including numerous movers and shakers in the Ruby and Rails communities.
“Distinguishing between junior and senior people in the Rails world is not so different from making the distinction in other web development environments.
“Junior Rails people have not dealt with scaling issues to the degree that senior people have. Getting a public-facing Rails application to perform under significant stress is more challenging than doing the same with other building materials such as PHP. Senior people know how to performance-test Rails applications, where to look for bottlenecks, and how to eliminate them one after another until performance is acceptable in real conditions. The Ra
@webdev1001
webdev1001 / gist:04a459981d5f5ac27c62
Created October 17, 2015 21:45 — forked from briancicutti/gist:3035155
Ruby Warrior Beginner Level 4 Solution
class Player
def play_turn(warrior)
if warrior.feel.enemy?
warrior.attack!
else
if warrior.health < 20 && !taking_damage?(warrior)
warrior.rest!
else
warrior.walk!
end
@webdev1001
webdev1001 / gist:65c842d5270f0852ccf7
Created October 8, 2015 11:14 — forked from olistik/gist:3894072
Ubuntu 12.04 Terminator config: solarized theme + iTerm2-like key bindings
# place this file in ~/.config/terminator/config
[global_config]
title_transmit_bg_color = "#d30102"
focus = system
[keybindings]
reset_clear = <Ctrl>R
new_tab = <Ctrl>T
split_horiz = <Ctrl><Shift>E
split_vert = <Ctrl>E
close_term = <Ctrl><Shift>W
@webdev1001
webdev1001 / ruby_setup.md
Created October 8, 2015 09:05 — forked from julionc/ruby_setup.md
Deploy Ruby On Rails on Ubuntu 14.04

Deploy Ruby On Rails on Ubuntu 14.04

Server: Nginx with Phusion Passenger

Ruby Version: 2.1.3

User System: deploy

User System

@webdev1001
webdev1001 / cookies.js
Created October 1, 2015 16:32 — forked from dmitry-korolev/cookies.js
Simple functions to work with cookies. Plain JS.
/**
* @link https://learn.javascript.ru/cookie
*/
function setCookie(name, value, options) {
options = options || {};
var expires = options.expires;
if (typeof expires == "number" && expires) {