Skip to content

Instantly share code, notes, and snippets.

View cseder's full-sized avatar

Chris Sederqvist cseder

View GitHub Profile
@cseder
cseder / cpp11_string_iterator.cpp
Last active December 19, 2015 22:58
Looping through the chars in a std::string an converting them to uppercase "in-place" (same memory address). Using C++11 features.
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s("chris sederqvist");
if (s.begin() != s.end())
triangular_numbers = Enumerator.new do |yielder| number = 0
count = 1
loop do
number += count
count += 1
yielder.yield number
end
end
class Enumerator
class String
def word_count
freq = Hash.new(0)
downcase.scan(/\w+/) { |word| freq[word] += 1 }
return freq
end
end
puts %{Dogs dogs dog dog dogs.}.word_count
@cseder
cseder / flutter_error.txt
Created November 12, 2018 23:55
Get this error when running a flutter app to a physical iOS device
error: module importing failed: ('invalid syntax', ('temp.py', 1, 27, 'import fruitstrap_00008020-001839583A98002E\n'))
backtrace unavailable