Skip to content

Instantly share code, notes, and snippets.

View matiasfha's full-sized avatar

Matías Hernández Arellano matiasfha

View GitHub Profile
#The mocked method to test
def save_obj(self, original_obj):
obj = super(CampaignProcessor, self).save_obj(original_obj)
for r in original_obj.featured_reviews.all():
review = (
r and
review_processor.get_or_create_obj(r)[0]
or None)
if review:
obj.featured_reviews.add(review)
Statement stmt = null;
String query =
"select attr1, attr2 from TU_TABLA";
try {
stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
String attr1 = rs.getString("attr1");
int attr2 = rs.getInt("attr2");
function tripOverviewController ($scope, pricingService) {
this.includeMeetAndGreet = function () {
if(this.checkoutData){
return this.checkoutData.trip.includeMeetAndGreet === 1;
}
return false;
};
this.showCouponField = function () {
if(this.checkoutData){
@matiasfha
matiasfha / index.html
Created June 2, 2011 20:19
nodejs + thrift +socket.io + couchdb
<!DOCTYPE>
<html>
<head>
<title>Test</title>
</head>
<body>
<div id="mensajes">
Hola Mundo
@matiasfha
matiasfha / circularbuffer.h
Created June 9, 2011 16:32
Buffer Circular (boost)
/**
This file is part of VisionStreaming.
VisionStreaming is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
VisionStreaming is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@matiasfha
matiasfha / html5example
Created October 10, 2012 15:38
HTML Example
<body>
<header>
<hgroup>
<h1>Page title</h1>
<h2>Page subtitle</h2>
</hgroup>
</header>
<nav>
<ul>
@matiasfha
matiasfha / index.html
Created November 26, 2012 15:26
CSS para ventana modal
<!--HTML para la ventana modal-->
<div class="modal">
<div class="inner-modal">
<div class="head">
</div>
<div class="content">
</div>
<div class="action">
@matiasfha
matiasfha / angular.js
Created November 4, 2015 18:54
Angular start method
(function(window, document, undefined) {
<!--
here goes entire AngularJS code
including functions, services, providers etc related code goes here
-->
if (window.angular.bootstrap) {
//AngularJS is already loaded, so we can return here...
console.log('WARNING: Tried to load angular more than once.');
return;
}
@matiasfha
matiasfha / angularInit.js
Created November 4, 2015 20:33
angularInit method
function angularInit(element, bootstrap) {
var appElement,
module,
config = {};
// The element `element` has priority over any other element
forEach(ngAttrPrefixes, function(prefix) {
var name = prefix + 'app';
if (!appElement && element.hasAttribute && element.hasAttribute(name)) {
@matiasfha
matiasfha / bootstrap.js
Created November 5, 2015 14:20
Angular bootstrap method
function bootstrap(element, modules, config) {
if (!isObject(config)) config = {};
var defaultConfig = {
strictDi: false
};
config = extend(defaultConfig, config);
var doBootstrap = function() {
element = jqLite(element);
if (element.injector()) {