Skip to content

Instantly share code, notes, and snippets.

@alecjacobs
alecjacobs / somescript.js
Created February 18, 2019 22:58
some js running
console.log('yo dog')
@alecjacobs
alecjacobs / bch-price.js
Last active December 15, 2021 20:08
JS snippet to get realtime BCH price from CryptoCompare "streamer" API :)
const socket = io.connect('https://streamer.cryptocompare.com/');
socket.emit('SubAdd', { subs: ['5~CCCAGG~BCH~USD'] });
socket.on("m", (message) => {
let messageData = message.split("~")
let tsym = messageData[2]
let flag = messageData[4]
if (tsym == 'BCH' && (flag == '1' || flag == '2')) {

TreeLand Planning/Ideas

  • Secret Features
    • Hit "e" to "enter" into a story (make it the top level of the tree)
      • Current bug: you can navigate out of the zoomed in view
      • Hit "esc" to exit
  • Long-term features / ideas
    • OT stuff (ShareJS)
  • More google docs like - other cursors visible while collaborating
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
Template.whateverYourTemplateIsNamed.helpers
models: ->
[{ "model": "intel i7" }, { "model": "intel i5" }]
r.db('test').table('tweet_feed')
.orderBy({index: r.desc('created_at')})
.pluck('tweet_data')
.map(function(tweet){return tweet('tweet_data')('user')('followers_count')})
.reduce(function(acc, val){ return acc.add(val) })
defmodule C do
def map([], _func), do: []
def map([ head | tail ], func), do: [func.(head) | map(tail, func)]
def child(element, func, parent) do
parent <- { self, func.(element) }
end
def spawn_children(collection, func) do
@alecjacobs
alecjacobs / big_odd.rb
Created February 10, 2013 02:21
A command line Ruby script that prompts the user for a number 10 times, each time printing the largest entered odd number.
largestOdd = 0
10.times do
print "enter a number: "
x = gets.chomp!.to_i
largestOdd = x if x.odd? && x > largestOdd
puts largestOdd == 0 ? "no odds" : "the biggest odd is: #{largestOdd}"
end