Skip to content

Instantly share code, notes, and snippets.

View nickdenardis's full-sized avatar

Nick DeNardis nickdenardis

View GitHub Profile
@nickdenardis
nickdenardis / formspring-get-recent-answers
Created December 31, 2010 14:45
Get a list of the recent answers for a user in Formspring
// Get the last question in the DB for this user
$this->ResetValues();
$this->SetValue('user_id', $user_id);
$last_question = current($this->GetAssoc('question_id', 'question_id', 'DESC', 0, 1));
// Start the API connection
$connection = new FormspringOAuth(CONSUMER_KEY, CONSUMER_SECRET,
$myUser->GetValue('oauth_token'), $myUser->GetValue('oauth_token_secret'));
// Grab new items in the inbox
@nickdenardis
nickdenardis / PHP Redirect in Chrome
Created February 4, 2011 13:53
Chrome is picky about the HTTP code being specified before the Location.
// Redirect
header("HTTP/1.1 301 Moved Permanently");
header('Location: ' . $results['url']);
die();
@nickdenardis
nickdenardis / gist:4191366
Last active October 13, 2015 11:48
rspec tasks example
require 'spec_helper'
describe "Tasks" do
before do
@task = Task.create :task => 'go to bed'
end
describe "GET /tasks" do
it "display some tasks" do
@nickdenardis
nickdenardis / gist:4191614
Created December 2, 2012 23:44
Ruby ERB examples
Loops:
<ul>
<% for task in @tasks %>
<li id="task_<%= task.id %>"><%= task.task %>
| <%= link_to 'Edit', edit_task_path(task) %>
| <%= link_to 'Delete', task, :method => 'delete' %>
</li>
<% end %>
</ul>
@nickdenardis
nickdenardis / gist:4200060
Last active October 13, 2015 13:07
Useful Ruby Commands
books.valu­es.each { |rate­| ratin­gs[rate] += 1 }
class BlogEntry
def initialize( title, mood, fulltext )
@time = Time.now
@title, @mood, @fulltext = title, mood, fulltext
end
end
---------------
@nickdenardis
nickdenardis / gist:4230300
Last active October 13, 2015 17:28
Useful git commands
http://learn.github.com/p/branching.html
https://github.com/Kunena/Kunena-2.0/wiki/Create-a-new-branch-with-git-and-manage-branches
Renaming a heroku app
$ heroku apps:rename newname --app oldname
http://newname.heroku.com/ | git@heroku.com:newname.git
@nickdenardis
nickdenardis / waynestate-global-v2.css
Created December 19, 2012 12:36
Non-responsive 960px wide Wayne State University header and footer CSS
@media all {
body {
background-color: #fff;
color: #000;
font-family: Arial,Helvetica,sans-serif;
font-size: 100%;
margin: 0;
padding: 0;
}
a {
@nickdenardis
nickdenardis / waynestate-header-v2.html
Created December 19, 2012 13:16
Non-responsive 960px wide Wayne State University header HTML
<div id="wsu-header">
<div class="c">
<ul class="skip">
<li><a href="#content">Skip to Content</a></li>
<li><a href="#menu">Skip to Navigation</a></li>
</ul>
<h1><a href="http://wayne.edu/"><img src="//wayne.edu/global/images/wsu-wayne-state-university.gif" alt="Wayne State University" width="344" height="33" /></a></h1>
<h2><a href="http://wayne.edu/aimhigher/"><img src="//wayne.edu/global/images/wsu-aim-higher.gif" alt="Aim Higher" width="85" height="13" /></a></h2>
<div id="tab">
<ul>
@nickdenardis
nickdenardis / waynestate-footer-v2.html
Last active December 9, 2015 22:18
Non-responsive 960px wide Wayne State University footer HTML
@nickdenardis
nickdenardis / gist:4564366
Last active December 11, 2015 07:09
Foundation Resources
Menu button
http://codepen.io/chriscoyier/pen/fzsqm
Change menu borders
.nav-bar li, .nav-bar li a, .nav-bar > li:last-child {
border: none;
box-shadow: none;
}