Skip to content

Instantly share code, notes, and snippets.

Matthew Machuga machuga

Block or report user

Report or block machuga

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@machuga
machuga / callback-purgatory-0.js
Last active Mar 22, 2019
Grokkable Concurrent JavaScript - Teaching Asynchronous Patterns and Refactorings
View callback-purgatory-0.js
const get = require('./get'); // get(url, callback)
const githubApi = 'https://api.github.com';
const githubEventsUrlFor = username => `${githubApi}/users/${username}/events`;
const githubRepoUrlFor = repo => `${githubApi}/repos/${repo}`;
const fetchReposForLatestActivity = (user, callback) => {
let timeout = setTimeout(function() {
callback(new Error('Timed out'));
}, 3000);
@machuga
machuga / google_analytics_turbolinks5.js
Created May 12, 2017 — forked from Startouf/ google_analytics_turbolinks5.js
Google Analytics for Turbolinks 5 (& Rails 5)
View google_analytics_turbolinks5.js
// Google Analytics code to work with Turbolniks 5
this.GoogleAnalytics = (function() {
function GoogleAnalytics() {}
GoogleAnalytics.load = function() {
var firstScript, ga;
window._gaq = [];
window._gaq.push(["_setAccount", GoogleAnalytics.analyticsId()]);
window._gaq.push(['_setAllowAnchor', true]);
@machuga
machuga / promise-example.js
Created Nov 18, 2016
Promise Example for Promise Talk
View promise-example.js
const githubApi = 'https://api.github.com';
const githubEventUrl = githubApi + '/users/machuga/events';
fetchReposForLatestActivity('machuga').then(console.log);
function fetchReposForLatestActivity(user, fn) {
return new Promise(function(resolve, reject) {
request(githubEventsUrlFor(user))
.then(getThreeEvents)
.then(fetchRepos)
@machuga
machuga / callback-example.js
Last active Nov 18, 2016
Callback Example for Promise Talk
View callback-example.js
const githubApi = 'https://api.github.com';
const githubEventUrl = githubApi + '/users/machuga/events';
fetchReposForLatestActivity('machuga', console.log);
function fetchReposForLatestActivity(user, fn) {
request(githubEventsUrlFor(user), function(allEvents) {
fetchRepos(getThreeEvents(allEvents), function(rawRepos) {
fn(rawRepos.map(getRepo));
});
@machuga
machuga / index.js
Last active Jan 9, 2016
Express Elm Compilation - basic functionality example. Needs refinement
View index.js
'use strict';
const spawn = require('child_process').spawn;
const express = require('express');
const app = express();
const server = require('http').createServer(app);
const compile = require("node-elm-compiler").compile;
app.listen(3000, function () {
console.log('Example app listening on port 3000!');
@machuga
machuga / evil-leader.el
Created Oct 6, 2015
Evil Leader config
View evil-leader.el
(global-evil-leader-mode)
(evil-leader/set-leader "<SPC>")
(evil-leader/set-key
"j" 'evil-window-down
"k" 'evil-window-up
"h" 'evil-window-left
"l" 'evil-window-right
"J" 'evil-window-move-very-bottom
"K" 'evil-window-move-very-top
View gist:e58e3b7e1d0cae0d3759
#include <unistd.h>
#include <mach/mach.h>
#include <mach/mach_vm.h>
#include <mach-o/dyld.h>
int
main (int argc, char * argv[])
{
volatile char * library;
const mach_vm_size_t page_size = getpagesize ();
@machuga
machuga / rules.md
Last active Oct 3, 2019 — forked from radar/rules.md
#laravel rules
View rules.md

Asking for help in #laravel on Freenode

Please behave in a polite, considerate, and inclusive manner in the channel at all times. People volunteer their time in the channel to help people like you with your Laravel problems and some respect (in both directions) will go an extremely long way.

When asking questions in the #laravel channel, please follow these 12 simple rules.

  1. Do your research before hand. Your question may be answerable with a quick Google search or by simply experimenting. If it's a concept you're confused about, first check out our Official Documentation. If you're using a method in Laravel, you can look it up in the API Docs.
  2. If you've tried Googling, explain what terms you've tried to use so people can better help you.
  3. Clearly explain what is happening and create a Paste (http://laravel.io/bin), (http://kopy.io), or (http://gist.github.com) to better explain yourself
  4. **Do not use any paste service that is no
@machuga
machuga / Gemfile
Last active Dec 14, 2015
Guard for Jasmine CLI tests
View Gemfile
source :rubygems
gem 'guard'
gem 'guard-shell'
gem 'rb-fsevent', :require => false
gem 'terminal-notifier-guard' # This will use OSX native notifications
@machuga
machuga / .vimrc
Created Jul 13, 2012
Vimrc file 07-13-2012
View .vimrc
set nocompatible
set number
set ruler
syntax on
" Set encoding
set encoding=utf-8
" Whitespace stuff
You can’t perform that action at this time.