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
'use strict'; | |
let path = require('path'); | |
let webpack = require('webpack'); | |
let baseConfig = require('./base'); | |
let defaultSettings = require('./defaults'); | |
let BrowserSyncPlugin = require('browser-sync-webpack-plugin'); | |
// Add needed plugins here | |
let BowerWebpackPlugin = require('bower-webpack-plugin'); |
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
trait ShoutoutEntityTable { | |
import shoutouts.utils.PgSlickDriver.api._ | |
class Shoutouts(tag: Tag) extends Table[ShoutoutEntity](tag, "shoutouts") { | |
def content = column[JsValue]("content") // <- instance of MyType in the case class | |
// ... all the other column members | |
def * = (id, url, title, content, tags, created, updated) <> (create, extract) |
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
# Copy all files recursively matching -iname to directory dest. | |
find ./filer_public -iname "*.jpg" -exec cp -t dest {} + |
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
# e.g. in myapp/templatetags/myapp_extras.py | |
from __future__ import absolute_import, unicode_literals | |
from django import template | |
from patterntests.views import SomePartial | |
register = template.Library() | |
def somepartial(context): | |
someview = SomePartial() | |
res = someview.get(context.get('request')) |
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 MyModelTest(SimpleTestCase): | |
def test_something_with_some_file(self): | |
my_model = MyModel() | |
my_model.save() | |
# We change the storage location to save into our test directory. | |
my_model._meta.get_field('some_file').storage.location = '/somewhere/else' | |
a_file = '/whatever/is/tosave.txt' | |
my_model.some_file.save( |
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
from django.core.files.storage import FileSystemStorage | |
def MyModel(models.Model): | |
# ... model stuff ... | |
some_file = models.FileField( | |
storage=FileSystemStorage( | |
location='/my/private/path/' | |
), | |
upload_to='downloads' |
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
'use strict'; | |
/** | |
* This is the actual root component that we want to either use in | |
* the context of a bigger ReactJS app or as a top level component used on a | |
* traditional Non-ReactJS host page. In the second case we want the component | |
* to expose a public API. | |
*/ | |
var React = require('React'); |
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 TreeNodeChoiceFieldMixin(object): | |
def __init__(self, queryset, *args, **kwargs): | |
self.level_indicator = kwargs.pop('level_indicator', '----') | |
super(TreeNodeChoiceFieldMixin, self).__init__(queryset, *args, **kwargs) | |
def _get_level_indicator(self, obj): | |
level = len(obj.get_ancestors()) | |
return mark_safe(conditional_escape(self.level_indicator) * level) | |
def label_from_instance(self, obj): |
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
-module(controller_example). | |
-export([event/2]). | |
-include_lib("controller_html_helper.hrl"). | |
html(Context) -> | |
Html = z_template:render("index.tpl", [{foo, 'bar'}, {bam, 1234}], Context), | |
z_context:output(Html, Context). |