Skip to content

Instantly share code, notes, and snippets.

@NickClark
NickClark / thoughts.markdown
Last active September 27, 2021 22:33
Elm vs TypeScript Thoughts

Elm and TypeScript

  • Elm Task - An Elm specific implementation of Observables (more limited?)
  • TS and Elm - Once it compiles it usually runs (Provided you're following the warnings provided in either the compiler output (better) or editor (best) )
  • Editor and tooling support?
  • TS and Elm - Typed Langs
  • Most suitable for complete apps, not just a JS compiler
  • Enforces Reactive programming - Angular 2 (Observables) provides the same thing, just not forced.
  • Know TS, know JS. Able to contribute back to the community easier.
  • Object assignment kinda weird: { point | x = 42 } Reason? (overall weird sytnax)
@NickClark
NickClark / index.html
Created August 4, 2017 01:29
Type issue in nw.js
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test</title>
</head>
<body>
<b>
<script>
document.write(
chrome.extension.getBackgroundPage().Function === Function
puts 'Hello there, and what\'s your name?'
name = gets
pp name
name = name.chomp
pp name
puts 'Your name is ' + name + '? What a lovely name!'
puts 'Pleased to meet you, ' + name + '. :)'

==Why am I getting the warnings?==

@NickClark
NickClark / a.markdown
Created April 22, 2012 01:36
Windows Compilation

I have a lib I am trying to link against at:

hitt\ext\hittsdk\H-ITTSDK_2.0.4\lib\windows\h-ittsdk.dll

It can find the header file at:

hitt\ext\hittsdk\H-ITTSDK_2.0.4\include\H-ITTSDK.h

I have this working on my Mac, but I need to now get it working on windows.

@NickClark
NickClark / sdk.rb
Created March 28, 2012 16:26
Trouble with ffi and multi arch lib
#console output
$ ruby lib/hitt/sdk.rb
/Users/nick/.rvm/gems/ruby-1.9.3-p0-perf/gems/ffi-1.0.12.rc1/lib/ffi/library.rb:121:in `block in ffi_lib': Could not open library 'lib/ext/libH-ITTSDK.so': dlopen(lib/ext/libH-ITTSDK.so, 5): no suitable image found. Did find: (LoadError)
lib/ext/libH-ITTSDK.so: unknown file type, first eight bytes: 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A
from /Users/nick/.rvm/gems/ruby-1.9.3-p0-perf/gems/ffi-1.0.12.rc1/lib/ffi/library.rb:88:in `map'
from /Users/nick/.rvm/gems/ruby-1.9.3-p0-perf/gems/ffi-1.0.12.rc1/lib/ffi/library.rb:88:in `ffi_lib'
from lib/hitt/sdk.rb:5:in `<module:Sdk>'
from lib/hitt/sdk.rb:3:in `<main>'
@NickClark
NickClark / toggle_field_on_select_value.js
Created June 14, 2011 16:15
How do you create a jquery plugin that needs to keep state?
$.fn.toggle_field_on_select_value = function(select_input, value) {
toggle = function (){
$select = $(select_input);
$this = $(this);
if($select.attr("value") == value){
$this.slideDown();
}else{
$this.slideUp();
}
}
@NickClark
NickClark / Error
Created May 13, 2011 01:09
Deployment Gemfile.lock woes
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
You have deleted from the Gemfile:
* guard-pow
* rb-fsevent
@NickClark
NickClark / explain.markdown
Created May 4, 2011 21:38
Error using launchy with cucumber and spork.

Description

This error occurs when I run this feature with spork. If I run it without spork, then it works as expected.

@NickClark
NickClark / big_import.rb
Created April 11, 2011 15:22
this would be best optimized as a MYSQL script
#client is a MYSQL::Client object
client.query("SELECT * FROM local_event_attendance").each do |ea|
event = Event.find_by_orig_id(table_prefix + ea["eventID"].to_s + current_import_year.year.to_s).try(:id)
person = Person.find_by_orig_id(table_prefix + ea["memberID"].to_s).try(:id)
Registration.create(
:event_id => event,
:person_id => person,
:created_at => ea["date"],
:uniform => ea["uniform"].to_s.downcase == "yes"
)