Skip to content

Instantly share code, notes, and snippets.

def mail_subscribers(book, attrs = {})
@book = book
@body ||=attrs[:body]
if attrs[:attachments]
puts attrs[:attachments]
attrs[:attachments].all? {
|attachment|
attachments[attachment[:filename]] = attachment[:content]
<div class="top-swiper-container" swiper="vert" my-fullscreen="y" ng-controller="mainCtrl" ng-class="{'info-open': infoOpen, 'nav-open': navOpen}">
<navigation ng-controller="infoCtrl">
<div id="info">
<div id="info-wrapper" my-info="data.info" ng-click="toggleInfo()">
</div>
</div>
<div class="nav-trigger" ng-click="toggleNav();"><span></span></div>
<div class="pagination-wrapper">
@walidvb
walidvb / soundcloud_filter.module
Created February 11, 2014 00:21
Adds visual and height manipulation to the html5 player
/*
* Modified on 11.02.2014 by walidvb
* to add a 'visual' checkbox, added by the soundcloud API
*
*
*
*/
<?php
angular.module('myApp.services', ['ngResource']).
service('Projects', ['$resource', '$filter',
function($resource, $filter)
{
var data = $resource('https://dl.dropboxusercontent.com/s/9jogzvut6v8xz62/works.json',{}, {getData: {method: 'GET'}});
this.getAllProjects = function() {
return data;
}
this.getProjectsByID = function(projectID) {
return $filter('filter')(data, {id: projectID})
mod = angular.module('infinite-scroll', [])
mod.directive 'infiniteScroll', ['$rootScope', '$window', '$timeout', ($rootScope, $window, $timeout) ->
link: (scope, elem, attrs) ->
$window = angular.element($window)
# from jQuery UI (https://github.com/jquery/jquery-ui/blob/2f497023261a7400295f4dd64c45139232a0ea4f/ui/jquery.ui.core.js#L60)
$scrollParent = elem.parents()
.filter ->
console.log ($.css this, 'overflow') + ($.css this, 'overflow-y') + ($.css this, 'overflow-x')
for(int i = 0; i < w; i+=chan)
{
for(int j = 0; j < h; j+=chan)
{
uchar v = srcImg.pixelAt(i, j) > 127 ? 255 : 0;
if(d){cout << v << endl; d = !d;}
dstImg.pixelWrite(v, i, j);
}
$view = new view;
$view->name = 'blog_view';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'blog-view';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
Image RDC::compensate(const Image& srcImg)
{
Image dstImg(srcImg.width, srcImg.height);
for (int i = 0; i < srcImg.width; i++)
{
for (int j = 0 ; j < srcImg.height; j++)
{
float newPix = 0;
//Simple fixed threshold method
if (srcImg.pixelAt(i,j) > 127)
@walidvb
walidvb / gist:4593774
Created January 22, 2013 10:53
transform Mat into Channel32f
//cv::imshow("", img.pixels);
Channel32f chan(img.width, img.height);
for(int i = 0; i < img.pixels.rows; i++)
{
for (int j = 0; j<img.pixels.cols; j++)
{
chan.setValue(ci::Vec2i(i, j), img.pixelAt(i, j));
}
}
// number of corners on the chessboard
Size boardSize(6,5);
//init the system
CalibController calibControl(boardSize);
//Load the images
string filePath = "/Users/Gaston/dev/RDC/tmp/IMG_0701.JPG";
Mat image = imread(filePath, CV_LOAD_IMAGE_COLOR);
//Resize the images to a more reasonable size before treatment