Skip to content

Instantly share code, notes, and snippets.

@walidvb
walidvb / parallax.js
Created March 25, 2017 13:35
Mapping 2017 parallax code
let $back;
const BACKGROUND_ID = '#background', SCROLL_SELECTOR = 'main';
//hard-coded backgoround image size to start parallax asap
let sizes = {
width: 1678, height: 2481
};
$(document).on('turbolinks:load', () => {
$(scrollSelector).on('scroll', handleParallax);
setSize();
@walidvb
walidvb / Parralax.js
Last active May 18, 2016 11:43
Parralax background image
var $elem = $('.has-background-image');
function parallax() {
var top = $elem.offset().top;
if((pos = (top-window.scrollY))-window.innerHeight <= 0)
{
var yPos = pos * 0.15;
var coords = "50% "+yPos+"px";
$elem.css("backgroundPosition", coords);
}
};
Job failed to load: allocator undefined for Proc. Handler: "--- !ruby/object:Delayed::PerformableMethod\nobject: !ruby/object:CommentsMailer\n _routes: \n _action_has_layout: true\n _mail_was_called: false\n _message: !ruby/object:Mail::Message\n body: !ruby/object:Mail::Body\n boundary: \n preamble: \n epilogue: \n charset: US-ASCII\n part_sort_order:\n - text/plain\n - text/enriched\n - text/html\n parts: !ruby/array:Mail::PartsList []\n raw_source: ''\n encoding: 7bit\n body_raw: \n separate_parts: false\n text_part: \n html_part: \n errors: \n header: !ruby/object:Mail::Header\n errors: []\n charset: UTF-8\n raw_source: ''\n fields: !ruby/array:Mail::FieldList []\n charset: UTF-8\n defaulted_charset: true\n smtp_envelope_from: \n smtp_envelope_to: \n perform_deliveries: true\n raise_delivery_errors: true\n delivery_handler: \n delivery_method: !ruby/object:Mail::SMTP\n settings:
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