Skip to content

Instantly share code, notes, and snippets.

View yefim's full-sized avatar

Yefim Vedernikoff yefim

View GitHub Profile

How I built a Her-inspired hack in 24 hours

On January 24th of this year I had the fortune of attending hackTECH in Santa Monica, CA. Having been raised in LA, I thought it would be the perfect opportunity to invite my little brother Sam and his friend Matthew to come hack with me. I had been to 22 hackathons at that point and considered myself to be a hackathon veteran.

Sam, Matthew, and I arrived to hackTECH late Friday afternoon and started brainstorming ideas. We walked by a few of the sponsor tables to get an idea for some of the API prizes that were being offered. Lob and Microsoft caught my eye and I pitched them the idea of a Windows Phone app that lets you dictate and send postcards to your friends. I had just seen the movie Her earlier that week and was inspired by the main protagonist's job in the movie. For those who haven't seen it, Theodore is basically a love guru who writes heartfelt letters for strangers

@yefim
yefim / app.js
Created April 9, 2014 23:51
Mongodb native driver and Expressjs intergration
var express = require('express');
var app = express();
var MongoClient = require('mongodb').MongoClient;
MongoClient.connect('mongodb://127.0.0.1:27017/test', function(err, db) {
var collection = db.collection('collection');
app.get('/', function(req, res) {
collection.find().toArray(function(err, results) {
res.json(results);
@yefim
yefim / venmo.py
Last active August 29, 2015 14:03
Venmo transaction total
from requests import get
url = "https://venmo.com/api/v5/users/<YOUR_USER_ID>/feed?access_token=<YOUR_ACCESS_TOKEN>"
transactions = []
while url:
data = get(url).json()
url = data.get('paging', {}).get('next', None)
for d in data.get('data', []):
transactions += d.get('transactions', [])
@yefim
yefim / web.js
Created July 23, 2014 01:03
500 as a Service
var express = require("express");
var logfmt = require("logfmt");
var app = express();
app.use(logfmt.requestLogger());
app.get('/', function(req, res) {
res.send(500);
});
@yefim
yefim / bind.js
Created April 26, 2015 17:41
Using bind to set parameters
var Item = React.createClass({
render: function() {
return (
<div onClick={this.props.handleClick.bind(this, this.props.item)}>{this.props.item}</div>;
);
}
})
var List = React.createClass({
handleClick: function(item) {
@yefim
yefim / create-repo.sh
Created May 4, 2012 06:10
Create a new GitHub repo
#!/bin/bash
read -s -p "GitHub password: " pass
# I assume the GitHub API and authentication works because I don't want to parse JSON
curl -u "yefim323:$pass" https://api.github.com/user/repos -d "{\"name\":\"$1\"}" > /dev/null
git remote add origin git@github.com:yefim323/$1.git
@yefim
yefim / sort_by_letter_freq.js
Created May 22, 2012 08:51
Sorts a string by the frequency of characters.
var sort_by_freq = function(str) {
var i, j;
var map = [];
var sorted = [];
for (i = 0; i < str.length; i++) {
if (map[str.charAt(i)] == null) {
map[str.charAt(i)] = 1;
} else {
map[str.charAt(i)] = map[str.charAt(i)] + 1;
}
@yefim
yefim / scrape.js
Created November 15, 2012 05:28
Simplest scraper
// Count all of the links from the nodejs build page
var jsdom = require("jsdom");
jsdom.env(
"http://nodejs.org/dist/",
["http://code.jquery.com/jquery.js"],
function (errors, window) {
$ = window.$;
console.log("there have been " + $("a").length + " nodejs releases!");
}
@yefim
yefim / doublell.cpp
Created December 16, 2012 04:29
Doubly Linked list implementation
#include <iostream>
#include <string>
#include "doublell.h"
using namespace std;
DoubleLL::DoubleLL()
{
head = NULL;
tail = NULL;
@yefim
yefim / merge_sort.coffee
Last active December 14, 2015 06:29
Merge Sort implemented in CoffeeScript
merge = (a, p, q, l) ->
L = a[p..q]
R = a[q+1..l]
L.push Infinity
R.push Infinity
i = 0
j = 0
for k in [p..l]
if L[i] <= R[j]
a[k] = L[i]