Skip to content

Instantly share code, notes, and snippets.

View bryangarza's full-sized avatar

Bryan Garza bryangarza

View GitHub Profile
data Customer = Customer {
customerID :: Int,
customerName :: String,
customerAddress :: Address
} deriving (Show)
@bryangarza
bryangarza / emacs commands
Created February 7, 2015 02:14
Emacs commands
To open a terminal, use `M-x ansi-term`
In ansi-term:
To switch to line-mode, and treat the terminal as a regular buffer, use `C-x C-j`.
If you want to switch back to char-mode (where you can't delete the prompt), `C-x C-k`.
To open a file: `C-x C-f`, and if the file doesn't exist, it'll be created.
To make a directory, use `mkdir` in the terminal, or use `M-x make-directory`.
To hide all other visible buffers, use `C-x 1`.
`C-x 2` creates a horizontal split, and `C-x 3` creates a vertical split.
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<meta charset="utf-8">
<title>cursors</title>
<script>
$('body').css('cursor', 'crosshair');
</script>
</head>
(define (sum-of-squares-two-larger-nums a b c)
(cond ((and (< a b) (< a c)) (sum-of-squares b c))
((and (< b a) (< b c)) (sum-of-squares a c))
(else (sum-of-squares a b))))
import java.util.ArrayList;
import java.lang.Integer;
import java.lang.ArrayIndexOutOfBoundsException;
class LocalMinMax {
public static void main(String[] args) {
int[] array = {4, 3, 2, 3, 4, 5, 4, 3, 4, 3, 4, 5, 4};
ArrayList<Integer> mins = new ArrayList<Integer>();
ArrayList<Integer> maxs = new ArrayList<Integer>();
[
{"author": "Pete Hunt", "text": "This is one comment"},
{"author": "Jordan Wa", "text": "This is *another* comment"},
{"author": "Bryan G", "text": "I'm currently changing comments"}
]
<html>
<head>
<title>Hello React</title>
<script src="http://fb.me/react-0.12.0.js"></script>
<script src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/showdown/0.3.1/showdown.min.js"></script>
</head>
<body>
<div id='content'></div>
<script src='build/tutorial1.js'></script>
var converter = new Showdown.converter();
var Comment = React.createClass({
render: function() {
var rawMarkup = converter.makeHtml(this.props.children.toString());
return (
<div className='comment'>
<h2 className='commentAuthor'>
{this.props.author}
</h2>
<span dangerouslySetInnerHTML={{__html: rawMarkup}} />
This file has been truncated, but you can view the full file.
{ "_id" : "1448660142068085", "from_name" : "Lamec Fletez", "message_tags" : [ { "$numberLong" : "10203744407903369" } ], "post_id" : "1448659768734789", "group_id" : "1448520968748669", "like_count" : 0, "created_time" : "2014-07-16T05:53:32+0000", "message" : "Hey Ankit, idk Lisp. Tell me why I should learn it.", "id" : "1448660142068085", "from_id" : "858100770888622" }
{ "_id" : "1448660395401393", "from_name" : "Ankit Ranjan", "post_id" : "1448659768734789", "group_id" : "1448520968748669", "like_count" : 4, "created_time" : "2014-07-16T05:54:43+0000", "message" : "Because, no matter what you decide to do with code, Lisp teaches you how to program. By thinking functionally and removing syntax, you get straight to the logic and expand your mind.", "id" : "1448660395401393", "from_id" : "10203744407903369" }
{ "_id" : "1448660648734701", "from_name" : "Ankit Ranjan", "post_id" : "1448659768734789", "group_id" : "1448520968748669", "like_count" : 10, "created_time" : "2014-07-16T05:56:19+0000", "message" :
(ns mostliked.core
(:require [cheshire.core :refer :all]))
(defn -main []
(let [likes (parsed-seq (clojure.java.io/reader "comments.hh.json") true)
likes-merged (map (fn [[who n]]
(into {} [[:from_name who]
[:like_count (apply + (map :like_count n))]]))
(group-by :from_name (doall (for [x likes]
(select-keys x [:from_name :like_count])))))