Skip to content

Instantly share code, notes, and snippets.

View futhr's full-sized avatar
:octocat:

Tobias Bohwalli futhr

:octocat:
View GitHub Profile
@aenain
aenain / analyze_modules.js
Last active December 7, 2022 21:26
JS script to visualize ES6 circular dependencies by producing a directed graph using dot notation.
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
@wesbos
wesbos / async-await.js
Created February 22, 2017 14:02
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@bmweiner
bmweiner / sonos_airplay.md
Last active December 30, 2023 19:30
Stream audio to any Sonos component via AirPlay using a Raspberry Pi.

Sonos Airplay

Stream audio to any Sonos component via AirPlay using a Raspberry Pi (Model B, Raspbian Jessie) and the following software:

  • Shairport Sync: configures the Raspberry Pi as an AirPlay audio player.
  • DarkIce: encodes audio received from AirPlay (system audio) and sends it to Icecast2.
  • Icecast2: serves streaming audio from DarkIce at a network URL.
@joefiorini
joefiorini / Brocfile.js
Created June 12, 2014 01:42
My setup for building an Angular.js app with Broccoli & grunt
var ngMin = require('broccoli-ng-min');
var uglify = require('broccoli-uglify-js');
var compileSass = require('broccoli-ruby-sass');
var pickFiles = require('broccoli-static-compiler');
var mergeTrees = require('broccoli-merge-trees');
var findBowerTrees = require('broccoli-bower');
var env = require('broccoli-env').getEnv();
var compileES6 = require('broccoli-es6-concatenator');
var app = 'app/scripts';
@xypaul
xypaul / tinymce-ember.js
Created May 14, 2014 06:32
TinyMCE 4 Ember Component
App.TinymceEditorComponent = Ember.Component.extend({
// Warning!!! only use tinyMCE not tinymce !!!
editor: null,
data: {},
watchData: true,
didInsertElement: function(){
var _this = this;
// The magic config - http://www.tinymce.com/wiki.php/Configuration
var config = {};
@teamon
teamon / post_representer.rb
Created May 7, 2014 18:25
Ruby representers without a library
module PostRepresenter
include Representer
using Representer
def basic(post)
select(post, :id, :name)
end
def details(post)
basic(post) & comments(post)
@michaelbaudino
michaelbaudino / rails_version_comparison.rb
Last active August 29, 2015 13:56
Rails version matching
def rails_version_matches?(requirement)
Gem::Requirement.new(requirement).satisfied_by? Gem::Version.new(::Rails::VERSION::STRING)
end
def rails_version_matches_any?(*requirements)
requirements.map{ |r| rails_version_matches?(r) }.reduce(:|)
end
def rails_version_matches_all?(*requirements)
requirements.map{ |r| rails_version_matches?(r) }.reduce(:&)
@magnetikonline
magnetikonline / README.md
Last active March 14, 2024 22:48
IE 7/8/9/10/11 Virtual machines from Microsoft - Linux w/VirtualBox installation notes.
@KevinTriplett
KevinTriplett / capybara_wait_until.rb
Last active December 14, 2015 12:38
Adding back the #wait_until to Capybara v2+ gem. Can probably be adapted for cucumber tests.
# add this file capybara_wait_until.rb to your /test directory
module Capybara
class Session
##
#
# Retry executing the block until a truthy result is returned or the timeout time is exceeded
#
# @param [Integer] timeout The amount of seconds to retry executing the given block
#
@hakanensari
hakanensari / honeybadger.rb
Created January 26, 2013 23:14
Honeybadger initializer
Honeybadger.configure do |config|
config.api_key = '12345678'
config.ignore.push "SignalException::SIGTERM",
"Excon::Errors::ServiceUnavailable",
"Excon::Errors::SocketError",
"Excon::Errors::Timeout"
config.async do |notice|
WorkingBadger.perform_async(notice.to_json) unless notice.ignore?