Skip to content

Instantly share code, notes, and snippets.

View maxfierke's full-sized avatar
🌋
NoMethodError: undefined method `status' for #<ProfileInfo:0x00007fc2ffae9f38>

Max Fierke maxfierke

🌋
NoMethodError: undefined method `status' for #<ProfileInfo:0x00007fc2ffae9f38>
View GitHub Profile

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@Seldaek
Seldaek / ContactControllerTest.php
Created May 25, 2011 13:48
Mailer service mocking for Symfony2
<?php
namespace Nelmio\HomeBundle\Tests\Controller;
use Nelmio\HomeBundle\Controller\ContactController;
use Liip\FunctionalTestBundle\Test\WebTestCase;
class ContactControllerTest extends WebTestCase
{
public function testEmail()
@jonashaag
jonashaag / 0-howto-listfield-django-admin.rst
Created September 7, 2011 09:41
Howto use ListFields in Django's admin

Howto use ListFields in Django's admin

Problem

Consider this blog post model:

models.py

@wowo
wowo / PHPUnit way to mock Doctrine2 Entity Manager.php
Created November 1, 2011 20:22
PHPUnit's way to mock Doctrine2 Entity Manager
<?php
class AbstractManagerBase extends \PHPUnit_Framework_TestCase
{
protected function getEmMock()
{
$emMock = $this->getMock('\Doctrine\ORM\EntityManager',
array('getRepository', 'getClassMetadata', 'persist', 'flush'), array(), '', false);
$emMock->expects($this->any())
->method('getRepository')
@sontek
sontek / snowjob.py
Created December 22, 2011 04:24
Make your terminal snow with python
#!/usr/bin/env python
import os
import random
import time
import platform
snowflakes = {}
try:
# Windows Support
@saetia
saetia / gist:1623487
Last active May 1, 2024 19:55
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@qiao
qiao / ip.js
Created January 17, 2012 11:27
Node.js get client IP address
// snippet taken from http://catapulty.tumblr.com/post/8303749793/heroku-and-node-js-how-to-get-the-client-ip-address
function getClientIp(req) {
var ipAddress;
// The request may be forwarded from local web server.
var forwardedIpsStr = req.header('x-forwarded-for');
if (forwardedIpsStr) {
// 'x-forwarded-for' header may return multiple IP addresses in
// the format: "client IP, proxy 1 IP, proxy 2 IP" so take the
// the first one
var forwardedIps = forwardedIpsStr.split(',');
@Seldaek
Seldaek / sha1hmac.js
Created February 3, 2012 13:37
SHA1 + HMAC in JS
var Crypto = {};
Crypto.sha1_hmac = function (msg, key) {
"use strict";
var oKeyPad, iKeyPad, iPadRes, bytes, i, len;
if (key.length > 64) {
// keys longer than blocksize are shortened
key = Crypto.sha1(key, true);
}
@oodavid
oodavid / README.md
Last active June 12, 2024 00:28 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@ielshareef
ielshareef / 0_how-to-use-embeddedmodelfield-in-django-admin.md
Created June 28, 2012 12:45
How to use EmbeddedModelField in Django's admin

How to Use EmbeddedModelField in Django's admin

by Ismail Elshareef

Problem

If you're using MongoDB with Django, you will need to manage ListField and EmbeddedModelField type fields in Django's admin module. Unfortunately, that's not so easy to do out of the box. You need to do some hacking to get it done. Here's a good link on how to use ListField in admin https://gist.github.com/1200165.

Now let's find out how we can use EmbeddedModelField with admin. Let's start hacking :)