Skip to content

Instantly share code, notes, and snippets.

Avatar

Paul Ruescher paulruescher

View GitHub Profile
@paulruescher
paulruescher / spawner.ex
Created Jan 29, 2019
Spins up "concurrent" tasks
View spawner.ex
defmodule Spawner do
def process() do
receive do
after
1_000 ->
IO.puts "1 seconds elapsed"
for i <- 0..40, i > 0 do
Task.start(ModuleName, :func_name, [[key: value]])
end
View gist:5a881fe2c2341068eae9
int main()
{
    // Variable declaration
    int choice;
    // Print the main menu
    cout << "CMPT 126 - Assignment 1\n";
    cout << "\nPlease select one of the followings:\n";
    cout << "1\tQuadratic equation solver.\n";
    cout << "2\tReverse an integer and sum its digits.\n";
View higher-order-component.js
const NotificationHoC = function(Component) {
return React.createClass({
componentDidMount() {
const success = (notifications) => {
this.setState({
notifications: notifications,
});
};
$.ajax({
View presentation-as-prop.js
const Container = React.createClass({
componentDidMount() {
const success = (notifications) => {
this.setState({
notifications: notifications,
});
};
$.ajax({
url: '/notifications',
View actions-up.js
const Container = React.createClass({
componentDidMount() {
const success = (notifications) => {
this.setState({
notifications: notifications,
});
};
$.ajax({
url: '/notifications',
View data-down.js
const Container = React.createClass({
componentDidMount() {
const success = (notifications) => {
this.setState({
notifications: notifications,
});
};
$.ajax({
url: '/notifications',
View pure-function-2.js
function fullName(firstName, lastName) {
return `${firstName} ${lastName}`;
}
function createEl(el) {
return document.createElement(el);
}
function wrapContentWithEl(el, content) {
return el.innerHTML = content;
View pure-function-1.js
function f(x) {
return x * 10;
}
function g(x) {
return x + 2;
}
f(g(2)); // 40
View notification-app-hoc.js
const notifications = [
{
date: "Nov 10, 2015 8:00:00",
message: "Tagged in a photo",
},
{
date: "Nov 10, 2015 9:00:00",
message: "Mentioned in a post",
},
];
View notification-app-v2.js
const notifications = [
{
date: "Nov 10, 2015 8:00:00",
message: "Tagged in a photo",
},
{
date: "Nov 10, 2015 9:00:00",
message: "Mentioned in a post",
},
];
You can’t perform that action at this time.