This file contains hidden or 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
# mkdir -p lib/templates/rails/scaffold_controller/ | |
# Put this under lib/templates/rails/scaffold_controller/controller.rb | |
class <%= controller_class_name %>Controller < ApplicationController | |
respond_to :html, :json | |
<% unless options[:singleton] -%> | |
expose(:<%= table_name %>) { <%= orm_class.all(class_name) %> } | |
<% end -%> | |
expose(:<%= file_name %>) |
This file contains hidden or 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 ApplicationController < ActionController::Base | |
protect_from_forgery | |
helper_method :current_user | |
def current_user | |
@current_user ||= User.find_by_auth_token(cookies.signed[:auth_token]) if cookies[:auth_token] | |
end | |
def authenticate_user! | |
redirect_to login_url unless current_user |
This file contains hidden or 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
/* | |
* Infix evaluator in C++. | |
* Haldun Bayhantopcu <[email protected]> 10976008 | |
* | |
* Usage: echo <expr> | ./infixeval | |
* Example: echo "((8+9)*(4-6)^4)" | ./infixeval | |
* Output: 272 | |
*/ | |
#include <cmath> | |
#include <iostream> |
This file contains hidden or 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
package main | |
import ( | |
"database/sql" | |
"errors" | |
"fmt" | |
_ "github.com/bmizerany/pq" | |
"os" | |
"regexp" | |
"strings" |
This file contains hidden or 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 Module | |
# We often find ourselves with a medium-sized chunk of behavior that we'd | |
# like to extract, but only mix in to a single class. | |
# | |
# We typically choose to leave the implementation directly in the class, | |
# perhaps with a comment, because the mental and visual overhead of defining | |
# a module, making it a Concern, and including it is just too great. | |
# | |
# | |
# Using comments as lightweight modularity: |
This file contains hidden or 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
// | |
// MNDDataModel.m | |
// Podcasts | |
// | |
// Created by Haldun Bayhantopcu on 24/10/13. | |
// Copyright (c) 2013 monoid. All rights reserved. | |
// | |
#import "MNDDataModel.h" |
This file contains hidden or 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
#define BLog(formatString, ...) NSLog((@"%s " formatString), __PRETTY_FUNCTION__, ##__VA_ARGS__); |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"html/template" | |
"github.com/gorilla/sessions" |
This file contains hidden or 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
package main | |
import "fmt" | |
type ( | |
tF func(int) int | |
tRF func(tF) tF | |
tX func(tX) tF | |
) |
OlderNewer