Skip to content

Instantly share code, notes, and snippets.

View holmesal's full-sized avatar
:bowtie:
makin'

Alonso Holmes holmesal

:bowtie:
makin'
View GitHub Profile
function color_my_prompt {
local __user_and_host="\[\033[01;32m\]\u@\h"
local __cur_location="\[\033[01;34m\]\w"
local __git_branch_color="\[\033[31m\]"
#local __git_branch="\`ruby -e \"print (%x{git branch 2> /dev/null}.grep(/^\*/).first || '').gsub(/^\* (.+)$/, '(\1) ')\"\`"
local __git_branch='`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`'
local __prompt_tail="\[\033[35m\]$"
local __last_color="\[\033[00m\]"
local __bolt_color="\[\033[31m\]"
#export PS1="$__user_and_host $__cur_location $__git_branch_color$__git_branch$__prompt_tail$__last_color "
var foods = ['falafel', 'popcorn', 'smoothie'];
/** @type {Array.<string>} */
// Is there any way to document the food parameter for the callback function below, without making a separate "parseFood" function?
var betterFoods = _.map(foods, function(food) {
return food + ' with rice'
});
@holmesal
holmesal / OSCReceiver.cs
Created April 24, 2016 01:26
Controlling a First Person Controller in Unity with a Balance Board
using UnityEngine;
using System.Collections;
using UnityStandardAssets.Characters.FirstPerson;
public class OSCReceiver : MonoBehaviour {
public FirstPersonController fpc;
// public string RemoteIP = "127.0.0.1";
public string RemoteIP = "192.168.29.102";
@holmesal
holmesal / 1overx.js
Created May 11, 2016 20:21
1/x with react-native Animated
import React, {
Animated,
Component,
View
} from 'react-native';
export default class EasingTest extends Component {
state = {
input: new Animated.Value(0)
How can we take some load off the DB when querying for realtime hearts?
Bottom line, it has to be fast as shit. So that means we should probably store it in redis.
What about:
Every time someone hearts someone else, add it to that user's list and set an expire time of the next happy hour.
Important question - should the potentials be created when the user hearts the other user, or when the other user requests their batch?
The second one.
import { GraphQLObjectType, GraphQLString, GraphQLInt, GraphQLList } from 'graphql';
import { globalIdField } from 'graphql-relay';
import CityDayType from '../../CityDay/types/CityDay';
import AccommodationPlacementType from '../../Supplier/types/AccommodationPlacement';
export default new GraphQLObjectType({
name: 'CityBooking',
description: 'The city booking object in Quickplan',
fields: () => ({
id: globalIdField('CityBooking', city => city._key),

Sync logs from s3 bucket

aws s3 sync s3://league-loadbalancer-logs2/league-production/AWSLogs/478410257198/elasticloadbalancing/us-east-1/2016/09/01 ./

Count requests by status code

awk '{if($13=="https://love.theleague.com:443/api/v1/person/me/potentials") print($8 " " $13)}' access.log | sort | uniq -c | sort -r

2pm - new york
2:30pm - dc
4pm - chicago
5pm - san francisco
6pm - los angeles
var QueryType = new GraphQLObjectType({
name: 'Query',
description: 'A type used to make queries',
fields: () => ({
node: nodeDefinitions.nodeField,
viewer: {
type: types.UserType,
description: 'The currently authenticated user',
resolve: (parent, _, {user}) => user
},
var UserType = new GraphQLObjectType({
name: 'User',
description: 'A venerable Chorus user',
isTypeOf: (obj, info) => obj instanceof db.User,
interfaces: [nodeDefinitions.nodeInterface],
fields: () => ({
id: globalIdField('User'),
username: {
type: GraphQLString,
description: 'A username.',