Skip to content

Instantly share code, notes, and snippets.

View PabloVallejo's full-sized avatar

Pablo Vallejo PabloVallejo

View GitHub Profile
  • Herramientas
  • Editor de texto
  • Git
  • Frameworks
  • Bootstrap
  • Resets
  • jQuery
  • CSS
  • CSS 3
  • Reset
bind: function( fn, context ) {
return function() {
return fn.apply( context, arguments );
}
}
@PabloVallejo
PabloVallejo / List_Model_Helper::thumb
Created February 4, 2014 17:10
List_Model_Helper::thumb
<?php
/**
* TODO: Write example
*/
public static function thumb( $list_id, $size ) {
$post_id = Arr::head( List_Model::make( $list_id )->get_items() );
@PabloVallejo
PabloVallejo / Post_Model.thumb.php
Created February 5, 2014 13:32
Post_Model::thumb
<?php
/**
* Get the post thumbnail src
*
* <code>
*
* // Print post thumbnail
* <img src="<?php echo Post_Model::thumb(); ?>" />
<?php
/**
*
* Mustache model
*/
/**
* Mustache model class
@PabloVallejo
PabloVallejo / email.php
Created February 5, 2014 20:00
Email_Model::get_notification_body
<?php
/**
* Return the body of a notification
*
* @param { str } notification slug
* @param { arr } arguments to pass to the notification
* @return { str || bool } email body, or false on error
*/
function get_notification_body( $slug = null, $args = array() ) {
@PabloVallejo
PabloVallejo / additional-images.php
Created February 12, 2014 16:45
additional images
<?php
// Additional images
// Note: after line 107 of 'controllers/bookmarklet.php'
if ( $req->additional_images )
Post_Meta::update( $id, ADDITIONAL_IMAGES, $req->additional_images );
# -*- coding: utf-8 -*-
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Div, Submit, HTML, Button, Row, Field
from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions
class MessageForm(forms.Form):
text_input = forms.CharField()
# views.py
class UserProfileUpdate(LoginRequiredMixin, UpdateView):
# ...
# Pass current user to form through `initial`
def get_form_kwargs(self, **kwargs):
kwargs = super(UserProfileUpdate, self).get_form_kwargs(**kwargs)
kwargs['initial']['user']=self.request.user
return kwargs
<snippet>
<content><![CDATA[base(this, '${1:method}'${2});${0}]]></content>
<tabTrigger>base</tabTrigger>
<scope>source.js</scope>
<description>Base method call</description>
</snippet>