Skip to content

Instantly share code, notes, and snippets.

View nelsonic's full-sized avatar
💭
Let's Build a Better World Together!☀️

Nelson nelsonic

💭
Let's Build a Better World Together!☀️
View GitHub Profile
@nelsonic
nelsonic / main.dart
Created June 11, 2020 22:37
This will not compile as the a is defined as `int` cannot be reassigned to a `String`
void main() {
var a = 42;
a = 'hello';
}
@nelsonic
nelsonic / softwareengineering
Created September 30, 2019 11:52 — forked from scottashipp/softwareengineering
Software Engineering Quotes for fortune
%
Simple things should be simple, complex things should be possible.
The Wiki Way: Quick Collaboration on the Web, Bo Leuf, Ward
Cunningham
%
Simplicity is the soul of efficiency.
Austin Freeman
%
I have yet to see any problem, however complicated, which, when you
looked at it in the right way, did not become still more complicated.
@nelsonic
nelsonic / change_spec.rb
Created January 19, 2013 03:00
Coin Change Problem solved in Ruby using While and Until. US Coins. Requires RSpec. To run: $ rspec change_spec.rb Not the fewest lines possible but definitely easy for others to understand. ;-)
class Change
def change(amount)
coins = []
remaining_amount = amount
while remaining_amount != 0
coin = get_highest_coin(remaining_amount)
coins << coin
remaining_amount = remaining_amount - coin
end
coins
@nelsonic
nelsonic / change_spec.rb
Created January 19, 2013 03:19
Coin Change Problem Single Method. Solved in Ruby. Nested until loops. ( requires RSpec) Available coins are USD: http://en.wikipedia.org/wiki/Coins_of_the_United_States_dollar ;-)
class Change
def change(amount)
available_coins = [100,50,25,10,5,1] # http://en.wikipedia.org/wiki/Coins_of_the_United_States_dollar
coins = []
index = 0
coin = available_coins[index]
remaining_amount = amount
until remaining_amount == 0
until remaining_amount >= coin
index = index + 1
@nelsonic
nelsonic / travis-deploy-ssh.md
Created May 25, 2018 19:56 — forked from m3t/travis-deploy-ssh.md
Continuous deployment over SSH with Tavis CI, e.g. gh-pages

On Mar 28, 2013 Dan Allen explained how to deploy to github-pages automatically. Many other GitHub users like Steve Klabnik and Domenic Denicola followed with the same approach:

Use an OAuth token with public_repo or repo permission to access the Github account over HTTPS inside a virtual build environment.

The same applies to Travis CI's built-in abilities, and there are more restrictions as deploying GitHub Releases works only for tags, not for branches.

Security concerns

The token grants write access for all of your (public) repositories and

@nelsonic
nelsonic / facebook-contact-info-summary.rb
Created March 23, 2018 15:46 — forked from dylanmckay/facebook-contact-info-summary.rb
A Ruby script for collecting phone record statistics from a Facebook user data dump
#! /usr/bin/env ruby
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It prints all cell phone call + SMS message + MMS records, plus a summary of each.
#
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created
# in whatever the working directory of the program is when executed.
#
@nelsonic
nelsonic / introrx.md
Created February 1, 2018 20:21 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@nelsonic
nelsonic / Main.elm
Created January 3, 2018 17:15 — forked from chrisbuttery/Main.elm
Elm 0.17. A simple Mouse.moves example
import Html exposing (Html, text, div)
import Html.App as Html
import Mouse exposing (..)
main =
Html.program
{ init = init
, view = view
, update = update
, subscriptions = subscriptions
@nelsonic
nelsonic / portable-node.md
Created August 29, 2016 10:10 — forked from domenic/portable-node.md
Tips for Writing Portable Node.js Code

Node.js core does its best to treat every platform equally. Even if most Node developers use OS X day to day, some use Windows, and most everyone deploys to Linux or Solaris. So it's important to keep your code portable between platforms, whether you're writing a library or an application.

Predictably, most cross-platform issues come from Windows. Things just work differently there! But if you're careful, and follow some simple best practices, your code can run just as well on Windows systems.

Paths and URLs

On Windows, paths are constructed with backslashes instead of forward slashes. So if you do your directory manipulation

{
"log": {
"version": "1.2",
"creator": {
"name": "F12 Developer Tools",
"version": ""
},
"entries": [
{
"startedDateTime": "2016-06-22T14:25:35.670Z",