Skip to content

Instantly share code, notes, and snippets.

View beneggett's full-sized avatar

Ben Eggett beneggett

View GitHub Profile
@beneggett
beneggett / gist:a93171c489df122a3419
Created October 2, 2014 02:14
GIt sync my projects
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;}
require 'httparty'
class Weather
attr_accessor :city
def initialize(city)
@city = CGI.escape(city)
end
# ...
<%= domain_stylesheet_link_tag "application", media: "all" %>
<%= domain_javascript_include_tag "application" %>
#...
$("#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\" />");
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
@beneggett
beneggett / polymorphic-associations-task.md
Last active July 17, 2022 05:06
Polymorphic Associations

Creating polymorphic associations

Create Tagging feature:

Create keywords to reference our media

Tag: name: (keyword)

Steps: 1 of 3

@beneggett
beneggett / fizz-buzz-ruby.md
Last active January 23, 2019 12:16
Fizz Buzz Test

Fizz Buzz Test

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

Answer & Refinement process

Don't look until you want to see how I thought through it:

Final Shortest Answer

@beneggett
beneggett / Gemfile
Created February 5, 2014 21:46
Migrating to Postgresql from another DB
# ...
gem 'pg'
# bundle install after, make sure you remove sqlite3, or other db gems
# ...

Replace your old links with a Rails AJAX helper link (remote: true)

<%= link_to "Show More >", project_path(project), remote: true %>

Format your controller to respond to javascript

format.js