Skip to content

Instantly share code, notes, and snippets.

@TylerLH
TylerLH / app.js
Last active February 23, 2019 00:44
Multiple Async/Await in Express Route
const express = require('express');
const axios = require('axios');
const app = express();
async function getFoo() {
return Promise.resolve('foo'); // this could be anything that resolves
}
async function getBarData() {
import React from 'react'
import baseStyle from './baseStyle'
const styles = theme => ({
...baseStyle,
bar: {
width: theme.spacing.unit * 3
}
})
@TylerLH
TylerLH / divide.sh
Last active August 29, 2015 14:19
Divide 2 numbers
#!/bin/bash
if [ $# -ne 2 ]
then
echo "You must enter 2 arguments. You entered $#".
exit 2
fi
if [ $(echo $1 | grep "[0-9]") ]
then
<html>
<head>
<title>Tyler Hughes</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Hey yo</h1>
</body>
</html>
@TylerLH
TylerLH / designer.html
Last active August 29, 2015 14:10
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
R = 2.0 # Cookies per second
C = 500.0 # Cost of a farm
F = 4.0 # CPS per farm owned
X = 2000.0 # Cookies needed to win
elapsedTime = 0.0
cookies = 0.0
timeForNextFarm = ->
cookiesNeeded = C - cookies
@TylerLH
TylerLH / Project1.java
Last active August 29, 2015 13:57
Project1.java
import java.util.Scanner;
public class Project1
{
public static void main (String[] args)
{
Scanner kb = new Scanner(System.in);
Boolean running = true;
double originalGrade = 0;
int userSelection = 0;
import java.util.Scanner;
public class TestGrade {
public static void main(String [ ] args) {
int numberOfGrades;
int total = 0;
float average;
Scanner keyboard = new Scanner(System.in);
@TylerLH
TylerLH / gist:5440398
Last active December 16, 2015 13:19 — forked from shanselman/gist:5422230
Comment spam template
{
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It
is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as
you did, the {internet|net|web} will be {much more|a lot more}
useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch}
your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any?
{Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe.
Thanks.|
@TylerLH
TylerLH / Trial.rb
Created August 1, 2012 20:17
Trial example URL generation
class Trial < ActiveRecord::Base
TRIAL_TYPES = ["usability","clickmap","interview","survey"]
has_many :stints, :dependent => :nullify
has_many :tasks, :dependent => :destroy
before_validation :generate_access_token
attr_accessible :url, :access_token, :trial_type, :title, :description
validates_presence_of :access_token, :trial_type, :title, :description