Skip to content

Instantly share code, notes, and snippets.

@Goom11
Goom11 / outputWeatherData
Created October 18, 2015 04:47
output of weather example from FPForTheIntrigued
/home/aman/.rvm/rubies/ruby-2.2.3/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /home/aman/RubymineProjects/FPForTheIntrigued/main.rb
https://weather.yahooapis.com/forecastrss?w=2391271
Denver
OH
37
https://weather.yahooapis.com/forecastrss?w=2391272
https://weather.yahooapis.com/forecastrss?w=2391273
Denver
OK
55
@Goom11
Goom11 / FPForTheIntrigued.rb
Created October 18, 2015 04:41
FPForTheIntrigued In Ruby Included weather xml example at end
numbers = [1, 2, 3, 4, 5, 6]
totalBad = 0
for element in numbers
totalBad += element
end
# puts totalBad
function pOrder(s1, s2, acc) {
if (s1.length == 0 && s2.length == 0) {
console.log(acc);
}
if (s1.length != 0) {
acc.push(s1.pop());
pOrder(s1, s2, acc);
s1.push(acc.pop());
}
if (s2.length != 0) {
@Goom11
Goom11 / isSearch.cpp
Last active August 29, 2015 14:12 — forked from n2westman/isSearch.cpp
#include <climits>
#include <stack>
typedef struct Holder {
Node* node;
int min;
int max;
Holder(Node* n, int min, int max): node(n), min(min), max(max) {}
} *Holder_p;
@Goom11
Goom11 / isSearch.cpp
Last active August 29, 2015 14:12 — forked from lowellbander/isSearch.cpp
Converted the lowellbander/isSearch.cpp into a one liner solution
#include <climits>
// Cracking the Coding Interview, Question 4.5
// Implement a function to check if a binary tree is a binary search tree
// One-liner version
bool isSearch(Node* root, int max = INT_MAX, int min = INT_MIN) {
return (!root)
|| (
!(root->value <= min)
&& !(root->value > max)
@Goom11
Goom11 / BetterSorry.java
Last active August 29, 2015 13:57
Explanation of Java BetterSorry
public final int getAndIncrement(int i) {
while (true) {
int current = get(i);
int next = current + 1;
if (compareAndSet(i, current, next))
return current;
}
}
//So this is how the AtomicIntegerArray implements getAndIncrement
@Goom11
Goom11 / moment.css
Last active May 25, 2016 05:53
Custom CSS file for Moment Firefox plugin
@font-face {
font-family: 'Raleway';
font-style: normal;
font-weight: 100;
src: url(https://github.com/theleagueof/raleway/raw/master/webfonts/raleway_thin-webfont.ttf) format('truetype');
}
@font-face {
font-family: 'Raleway';
font-style: normal;
font-weight: 300;
@Goom11
Goom11 / hangman
Created January 4, 2013 23:41 — forked from anonymous/hangman
#include<iostream>
#include<cstring>
using namespace std;
const int MAX_WORD_LEN = 100;
const int TOTAL_LIVES = 10;
int find_len( const char word[] );
void clear_screen();