LOL
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
class Family < ActiveRecord::Base | |
def self.with_discontinued_accessories | |
joins(:products).where({ | |
:products => { | |
:accessory => true, | |
:production_status => 'discontinued', | |
:active => true, | |
:parent_id => nil | |
} |
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
class Breadcrumb | |
include ActionView::Helpers::TagHelper | |
def initialize | |
@crumbs = [] | |
end | |
def append(name, link) | |
@crumbs << Breadcrumb::Crumb.new(name, link) | |
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
def find_suggestions_for(restaurant) | |
past_orders = [] | |
orders.each {|o| past_orders << o if o.restaurant == restaurant } | |
past_orders | |
end | |
def find_suggestions_for(restaurant) | |
orders.inject([]) do |result, order| | |
result << order if order.restaurant == restaurant |
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
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
struct Person { | |
char *name; | |
}; | |
struct Person *create_person_stack(char *name) | |
{ |
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
#include <stdio.h> | |
#include <string.h> | |
struct Person { | |
char *name; | |
}; | |
int main(int argc, char *argv[]) | |
{ | |
int i = 0; |
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
/* Copyright (C) 1991, 1996, 1997, 1998, 2002 Free Software Foundation, Inc. | |
This file is part of the GNU C Library. | |
The GNU C Library is free software; you can redistribute it and/or | |
modify it under the terms of the GNU Lesser General Public | |
License as published by the Free Software Foundation; either | |
version 2.1 of the License, or (at your option) any later version. | |
The GNU C Library is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
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
/* $OpenBSD: strdup.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */ | |
/* | |
* Copyright (c) 1988, 1993 | |
* The Regents of the University of California. All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions | |
* are met: | |
* 1. Redistributions of source code must retain the above copyright |
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 ruby | |
# Usage: ./encode-test /path/to/encode.c | |
require 'fileutils' | |
def directory(path) | |
path = File.expand_path(path) | |
if File.directory?(path) | |
path |