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
# ... | |
gem 'pg' | |
# bundle install after, make sure you remove sqlite3, or other db gems | |
# ... |
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
15.times do | |
project = Project.create(:completion_date => Time.now + 5.days, :description => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas posuere metus non erat lacinia scelerisque. Donec pharetra, orci ut sollicitudin egestas, augue enim pharetra tellus, nec pretium metus est ac ante. Nulla varius lacinia tortor, ac dapibus elit vehicula non. Praesent bibendum quis est sed varius. Integer accumsan fringilla est, a elementum metus pulvinar nec. Nullam commodo malesuada tortor in tincidunt. Nullam vel facilisis augue, et ornare neque. Nunc vitae odio aliquet, pharetra ante in, vestibulum erat. Duis sed fringilla turpis, vitae tempor nisl. Praesent quis hendrerit massa, in pretium mauris. Nunc luctus ac lectus ut consectetur. Ut convallis mauris eget ante viverra, porttitor euismod erat tincidunt. Maecenas et varius sem. Aenean a elit non nibh ultricies volutpat at nec dui. Suspendisse lobortis purus vitae ipsum consectetur, vel feugiat erat vehicula. \n \n Aenean vel elementum nibh, im |
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
$("#merchants-list tbody tr ").find('td:first :checkbox').each(function(){ | |
var $target = $(this), | |
value, | |
$indicator; | |
if ( $target.hasClass( "checkbox" ) ) { | |
// Check the check box | |
value = "1"; | |
$target.parents("tr:first").find("td:first :checkbox").attr("checked","checked"); | |
$indicator = $("<img src=\"/images/loader.dots.gif\" class=\"update-checkbox\" />"); |
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
# ... | |
<%= domain_stylesheet_link_tag "application", media: "all" %> | |
<%= domain_javascript_include_tag "application" %> | |
#... |
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
require 'httparty' | |
class Weather | |
attr_accessor :city | |
def initialize(city) | |
@city = CGI.escape(city) | |
end | |
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
DIRECTORY_TO_SYNC=~/Sites/my-repo-path/; for REPO in `ls $DIRECTORY_TO_SYNC`; do (cd "$DIRECTORY_TO_SYNC/$REPO"; pwd; git pull); done; unset DIRECTORY_TO_SYNC; | |
# zshell alias: | |
pullrepos() {DIRECTORY_TO_SYNC=~/Sites/my-repo-path/; for REPO in `ls $DIRECTORY_TO_SYNC`; do (cd "$DIRECTORY_TO_SYNC/$REPO"; pwd; git pull); done; unset DIRECTORY_TO_SYNC;} |
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/env bash | |
# Usage: pair [<github-user>] [-t <tmux-session>] | |
# | |
# Copy the command to clipboard which grants another person access to the tmux | |
# session on your machine. The resulting command is in format: | |
# | |
# ssh -t <USER>@<HOST> 'tmux attach -t <SESSION>' | |
# | |
# When given a GitHub username, it will adopt SSH keys from their GitHub | |
# account and add them to your `~/.ssh/authorized_keys`. |
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
# Create a private key | |
openssl genrsa -des3 -out server.pass.key 2048 | |
# Strip password from private key | |
openssl rsa -in server.pass.key -out server.key | |
# Generate a CSR | |
openssl req -nodes -new -key server.key -out server.csr | |
# For NGINX, request a single PEM certificate, otherwise you'll get a SSL authority cert & site cert. |
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
# admin/seo/_seo_form.html.erb | |
<div class='full-inputs'> | |
<%= simple_form_for seo, remote: true, url: admin_update_seo_path(seo) do |f| %> | |
<%= f.input :content, required: true, as: :text, input_html: {rows: 2, maxlength: "#{ seo.name == 'title' ? '70' : '155' }"}, label: seo.name.try(:humanize), hint: "<span class='character-count green'> </span> #{seo.name.try(:humanize)} should be no longer than #{ seo.name == 'title' ? '70' : '155' } characters" %> | |
<div class='text-center'> | |
<button class='btn btn-primary'>Update</button> | |
<a href="#<%= page %>" class='cancel-seo btn btn-warning' data-attribute="<%=f.object.id %>"> Cancel</a> | |
<% end %> |
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
# Better each() for use with coffeescript | |
# 1. Wraps child in jquery object | |
# 2. Sets child first argument, so that fat-binding can be used. | |
# 3. Sets @ as well, for normal binds | |
jQuery.fn.loop = (block) -> | |
for i in @ | |
element = jQuery(i) | |
res = block.call element, element | |
break if res == false |
OlderNewer