Skip to content

Instantly share code, notes, and snippets.

View ds0nt's full-sized avatar
🏠
Working from home

Daniel Sont ds0nt

🏠
Working from home
View GitHub Profile
var camoptions = {
limit: 1,
destinationType: Camera.DestinationType.FILE_URI,
targetWidth: 512,
targetHeight: 512,
sourceType: (source == 1) ? Camera.PictureSourceType.CAMERA : Camera.PictureSourceType.PHOTOLIBRARY
};
navigator.camera.getPicture(function onSuccess(file) {
var camOpen = function(source) {
var camoptions = {
limit: 1,
destinationType: Camera.DestinationType.FILE_URI,
targetWidth: 512,
targetHeight: 512,
sourceType: (source == 1) ? Camera.PictureSourceType.CAMERA : Camera.PictureSourceType.PHOTOLIBRARY
};
@ds0nt
ds0nt / gist:d22dbc2bd051a629b097
Created December 22, 2014 03:37
metamaps dockerfile
# Dockerfile for MetaMaps
FROM ruby:2.1.5
MAINTAINER Daniel Sont "dan.sont@gmail.com"
# nokogiri+vagrant broken dependency issues
ENV NOKOGIRI_USE_SYSTEM_LIBRARIES 1
RUN apt-get install libxml2 libxml2-dev libxslt1-dev -y
@ds0nt
ds0nt / IoC react router
Created January 13, 2015 02:55
Idea for IoC React Router
psueodocode ftw
layout ....
todo
render
<div>
<expects todolist /> //dependency inverted .. decoupled. todolist is an abstraction
</div>
@ds0nt
ds0nt / gist:554c38b7ab0aa47e1a69
Created February 14, 2015 01:59
recursive load files from directory
var path = require('path');
var nodedir = require('node-dir');
module.exports = function (root, ext, done) {
var data = {};
var onFile = function(err, content, filename, next) {
if (err) throw err;
data[filename.replace(root, '').replace(ext, '')] = content;
next();
@ds0nt
ds0nt / gist:3e892047d9de25dc13a7
Last active August 29, 2015 14:15
ES6 Generators and Tagged Template Strings in io.js!
var _ = require('lodash');
function taggzies () {
var strings = arguments[0];
var vals = _.slice(arguments, 1);
//ES6 Generator
function* val() {
var len = vals.length;
for (var i = 0; i < len; i++) yield vals[i];
<style>
svg {
shape-rendering: geometricPrecision;
z-index: -1;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
@ds0nt
ds0nt / install.sh
Created April 10, 2015 08:10
install reaction commerce
#!/bin/bash
curl https://install.meteor.com | /bin/sh && \
git clone https://github.com/reactioncommerce/reaction.git && \
cd reaction && git checkout master && \
meteor
module.exports.create = function* () {
var res = yield users.find({ email: this.body.email, password: this.body.password });
if (res) {
return res.send(401, 'That user already exists');
}
yield users.insert({ email: this.body.email, password: somehashything(this.body.password) });
// etc...
};
@ds0nt
ds0nt / d3fun.js
Last active August 29, 2015 14:20
function foo(data) {
console.log(data);
var join = d3.select('div.test').selectAll('span').data(data, function(d, i) { return d.v })
join.exit().remove();
join.enter().append('span').text(function(d) { return d.v } )
join.sort();
}
$(function () {
d3.select('body').append('div').html(layout)