Skip to content

Instantly share code, notes, and snippets.

View drager's full-sized avatar
🦀
🦀 🕸️

Jesper Håkansson drager

🦀
🦀 🕸️
View GitHub Profile
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
private
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
rescue ActiveRecord::RecordNotFound
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
# -*- coding: utf-8 -*-
from django.template.defaultfilters import slugify
from django.core.urlresolvers import reverse
from notifications import notify
def notify_topic_subscribers(post):
topic = post.topic
for user in topic.subscribers.all():

Irssi in Mac OS X Notification Center

Mou icon

Overview

This guide will explain how you can make irc messages in a screen on a remote server appear in your Mac OS X Lion Notification Center with the help of terminal-notifier.

We will also explain how the process can be automatically started each time you log in to your Mac and ensure the connection to the server is kept alive.

Packages for meteor applications

  • Meteor Core
    • standard-app-packages
  • Routing
    • iron:router
    • zimme:iron-router-active
  • UI and UX
    • fastclick
  • meteorhacks:fast-render
(py34dj17)$ python manage.py test functional_tests
Creating test database for alias 'default'...
E
======================================================================
ERROR: test_can_login_via_oauth (functional_tests.test_login_via_oauth.LoginViaOauthTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/drager/toerh/functional_tests/test_login_via_oauth.py", line 7, in test_can_login_via_oauth
self.login()
from django.contrib.auth.models import User
from django.core.management.base import NoArgsCommand
from django.utils.timezone import now
class Command(NoArgsCommand):
help = "Delete inactive users that has a expired activation key."
def handle(self, **options):
User.objects.filter(is_active=False, userprofile__key_expires__lte=now()).delete()
"scripts": {
"postinstall": "tsd install",
"start": "npm run build && npm run packager",
"build": "npm-run-all build:*",
"build:typescript": "tsconfig && tsc",
"build:babel": "babel .tmp/ts --out-dir dist",
"lint": "npm-run-all lint:*",
"lint:typescript": "tslint `find app -name '*.ts?'`",
"packager": "node_modules/react-native/packager/packager.sh --skipflow --root dist",
"tsconfig": "tsconfig"

![mshang](data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAAHUAAAC2CAYAAADneMKmAAALiklEQVR4Xu2dbWxVRRrH/32hLS9tgSywsBXSBgJoVqhAERsDFpC0NhaISl3i+qGQsIhfMEujEKsJqIlm3f2gUbAE0qwQNRZJNcUaFiVCG0qh9SUUsbAlsBQo0IaW21LanTmXe3sutL333Dtzzpy5z5D7pcx5Zp7/b55z58ydZ05MHyugopUCMQRVK56GMwRVP6YEVUOmBJWg6qiAhj7RdypB1VABDV2iSCWoGiqgoUsUqQRVQwU0dIkilaBqqICGLlGkElT1Fbh8Gbh9G4iPB8aPZ79YxKjfZ9E91CZS6+qAF14Afv21X6LkZKC0FHjmmeiCqwXUc+eA9HQvzDfeAB59FPjlF+CVV7x/27ULePFF0fGgrj0toH76KbB6NfDDD8Djj/eL/dNPwMMPA089BXz1FRAXpy4IkT3TAupLLwFffAGcPg2kpgbKw/+vshKorwdGjRIpnbq2tIC6cydQVAQUFgLFxcD06cDw4eqKLrtnWkC9csX7PdrU1C/X0qVAfj6wZAnw4IOyZVTLvhZQuaQ9PcDRo0BVlfdTXd0v9LZtwGuvqSW8zN5oAbW9HRgxwvts6ittbcCRI8CGDd4I5rPhaIlY10Pt6PDOcBcvBrZvv3/8f/458NxzwLFjwNy5MuNDHduuh+rxAPPnA5cuAT/+CEydGijuO+8Ar77qnf1y+NFQXA+VQ9q3D1ixwouLryDNnu2F/NlnwO7dQHY2cOhQ4O1ZZ7haQOWAKiq8jzV87ddc+CPOpk3A2LE6Ywz0TRuo3K3ubuD8ee+C/rBhwIQJ0bPgYMaqFdToicWhPSWoGo4EgkpQNVRAQ5e0itRU9hNNO19eAvoKCwtj2AcFBQUaYtP8O9UE0vA0JSXFALtnzx7s3bsXBw4cYL/eFBqfZcuWRQVgV0bqQCDb+GLv3RLDNib5Tj3wsCUnDpd/ampq/IA

Case 1

match(10) {
  w < 10 => print('x is less than 10');
  x > 10 => print('x is greater than 10');
  10 => print('x is equal to 10');
}