Skip to content

Instantly share code, notes, and snippets.

View martisj's full-sized avatar
🐊

Martin Sjåstad martisj

🐊
View GitHub Profile
@martisj
martisj / config.php
Created September 9, 2012 09:57
config
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
@martisj
martisj / kingofhearts.php
Created September 9, 2012 09:52
controller
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class KingOfHearts extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->template->title('The King of Hearts - A short story about whales and seagulls');
}
@martisj
martisj / _feed_connection.php
Created September 6, 2012 11:29
The part that generates the specific activity entry, i.e. the one that shows the connections between the current users friends.
<?
$friends_friend = repo('Users')->findOneBy(array('id'=>$notification->get_entity_id()));
$connected = array();
$displayed = array(); //used to prevent multiple classes being displayed
foreach($all_notifications as $connected_to)
{
// var_doctrine($connected_to);
// die();
$fid = $connected_to->get_user_from_id();
@martisj
martisj / activity.php
Created September 6, 2012 11:28
view that handles the different types of activities
<?if(count($groups) == 0) :?>
<div class="home_note">
<div class="home_bg">
<div class="inner_padding">
<div class="clear"></div>
<h1 class="uni">WHAT'S NEXT?</h1>
<p>As you and fellow students use UCROO relevant information will appear in this Home Feed.
In the mean time here are a few things you can do to get started.</p><br>
<ul>
<li>Check out the <?=anchor('classes','classes')?> - try posting a question!</li>
@martisj
martisj / home.php
Created September 6, 2012 11:27
Controller method that parses data for the view
// group the notifications by entity_id
$groups = array();
foreach($notifications as $notif){
$entity_id = $notif->get_entity_id();
// echo $entity_id;
$entity = $this->em->getRepository('models\\'.$notif->get_entity_type())->find($entity_id);
$type = $notif->get_type();
// notification are grouped together. ww: changed array key to now include the type of
// notifcation as to not get 2 types with the same id creating one alert
@martisj
martisj / post_to_class_feed.py
Created August 29, 2012 06:39
delete comment
def test_delete_comment(self):
driver = self.driver
uid = uuid.uuid4()
sentence = self._create_random_sentence()
comment_text = str(uid) + ' | ' + sentence
driver.find_element_by_link_text(self.unit_code).click()
comments_count = len(driver.find_elements_by_css_selector('.comments_container li'))
@martisj
martisj / dabblet.css
Created August 3, 2012 08:22 — forked from anonymous/dabblet.css
Lining up form elements
/**
* Lining up form elements
*/
@martisj
martisj / feed.php
Created May 21, 2012 12:20
doctrine object retrieval
$post = new models\Post;
$user = get_user($uid);
$post->setUser($user);
$embedly_post = $this->embedly_post($user_post);
$post->setContent($embedly_post);
$post->setCategory($type);
$post->setCampus_id($cid);
$post->setDate_order(date_create(now_mysql()));
$post->setDate_created(date_create(now_mysql()));
require 'spec_helper'
# describe "Tasks" do
# describe "GET /tasks" do
# it "display some tasks" do
# @task = Task.create :task => 'go to bed'
# visit tasks_path
# page.should have_content 'go to bed'
require 'spec_helper'
describe "Tasks" do
describe "GET /tasks" do
it "display some tasks" do
@task = Task.create :task => 'go to bed'
visit tasks_path
page.should have_content 'go to bed'