Skip to content

Instantly share code, notes, and snippets.

@hedgerh
hedgerh / express.js
Last active August 29, 2015 13:56
Problem loading sources
'use strict';
/**
* Module dependencies.
*/
var express = require('express'),
consolidate = require('consolidate'),
mongoStore = require('connect-mongo')(express),
flash = require('connect-flash'),
helpers = require('view-helpers'),
@hedgerh
hedgerh / DeadLock.java
Last active August 29, 2015 13:56
This version works, but it's because I added a wait(200) after the first wait. The problem without the wait(200) is that sometimes the girl monitor wakes up and "asks Boy to confirm" before the boy can even ping.
import java.applet.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
// Attempt at a simple handshake. Girl pings Boy, gets confirmation.
// Then Boy pings girl, get confirmation.
class Monitor {
String name;
public Monitor (String name) { this.name = name; }
var stream = {
tracks: [],
playlists: []
};
function buildStream(group, callback) {
var artists = group.artists;
var params = {
limit: 5
};
get('/user/12345/stream', params)
.then(function(items) {
var stream = [];
var new_item;
_.each(items, function(item) {
/* see if track is a repost. item.type can have the values:
'track', 'playlist', 'track_repost', or 'playlist_repost'
*/
new_item.is_repost = (item.type.slice(-6) === 'repost');
{
"kind": "stream_item",
"type": "playlist_repost",
"created_at": "2014/06/22 22:36:02 +0000",
"track": null,
"playlist": {
"kind": "playlist",
"id": 40585650,
"created_at": "2014/06/20 16:22:58 +0000",
"user_id": 315279,
/**
* This is an example of the results from requesting
* a user stream from Soundcloud's API.
*
* The objects in the collection are a mix of tracks and playlists
* sorted by date.
*
* @type {Array}
*/
var items = [
@hedgerh
hedgerh / aboutme
Created June 30, 2014 01:42
development
I am a 21 year old student, who is attending Rigas Technical University for Computer Science and Information Technology. I will be graduating after this semeseter. I am passionate about web development and technology.
define(['angular', 'util/messaging', 'util/messagingClient', 'content/contentServices'],
function(angular, messaging, client, services) {
'use strict';
return angular.module('seaApp.controllers', ['seaApp.services'])
// content controller
.controller('StreamController', ['$scope', '$location', '$q', 'streamService', 'Groups',
function($scope, $location, $q, streamService, Groups) {
require(['content/controllers/streamController'], function(StreamController) {
<div class="activity">
<div role="group" class="sound playlist streamContext focused" aria-label="Playlist: Mixes by CRNKN"> <a class="sound__coverArt" href="/crnkn/sets/mixes"> <span class="coverArt__infoItem"> <div class="playlistLength"><span title="3 tracks" class="sc-ministats sc-ministats-small sc-ministats-inverted sc-ministats-sounds"> 3
</span>
</div> </span> <div class="image readOnly customImage image__hasPlaceholder" style="height: 100%; width: 100%;"> <img class="image__full g-opacity-transition" src="https://i1.sndcdn.com/artworks-000083984068-v5m5i2-t120x120.jpg?2aaad5e" width="100%" height="100%" alt="Mixes" style="opacity: 1;">
</div> </a>
<div class="sound__header"> <div class="soundTitle sc-clearfix sc-hyphenate sc-type-h2"><div class="sc-type-light"> <a href="/crnkn" class="soundTitle__username sc-link-light "> CRNKN </a>
</div> <div> <div class="sc-media-image soundTitle__playButton "> <button class="sc-button sc-button-play sc-button-large" title="Play">Play
</button> </div
var gulp = require('gulp');
var tinylr = require('tiny-lr');
gulp.task('dev', function () {
var lr = tinylr();
lr.listen(35729);
gulp.watch(['**.{js,css,html}'], function (evt) {
lr.changed({
body: {