Skip to content

Instantly share code, notes, and snippets.

View DanCouper's full-sized avatar

Dan Couper DanCouper

  • Strive Gaming
  • Newcastle, UK
  • 01:47 (UTC +01:00)
  • X @DanCouper
View GitHub Profile
@Integralist
Integralist / flatten-array.js
Created May 20, 2015 08:35
Array flatten function written in ES6 syntax
const flattenTco = ([first, ...rest], accumulator) =>
(first === undefined)
? accumulator
: (Array.isArray(first))
? flattenTco([...first, ...rest])
: flattenTco(rest, accumulator.concat(first))
const flatten = (n) => flattenTco(n, []);
console.log(flatten([[1,[2,[[3]]]],4,[5,[[[6]]]]]))
@cloudbring
cloudbring / README.md
Last active May 1, 2017 02:42
Building an Phoenix / Elixir Web App in June 2015
@Kavec
Kavec / badfizz.exs
Last active October 29, 2015 07:06
An overpowered, lazy FizzBuzz using macros and Elixir's Stream module.
#!/usr/bin/env elixir
defmodule BadFizz do
# See "Other Notes" section for more on this macro.
defmacrop automate_fizz(fizzers, n) do
# To begin, we need to process fizzers to produce the various components
# we're using in the final assembly. As told by Mickens telling as Antonio
# Banderas, first you must specify a mapping function:
build_parts = (fn {fz, n} ->
ast_ref = {fz |> String.downcase |> String.to_atom, [], __MODULE__}
@JoshCheek
JoshCheek / learning_elm.md
Last active February 18, 2017 22:50
Learning Elm

Learning Elm

What is it? (20 min)

Glance through a few of the examples, maybe 5 or so, to see what kinds of things Elm is doing, what domains they're in, what the code looks like, what other people think Elm is.

@jasongilman
jasongilman / atom_clojure_setup.md
Last active May 11, 2024 02:25
This describes how I setup Atom for Clojure Development.

Atom Clojure Setup

This describes how I setup Atom for an ideal Clojure development workflow. This fixes indentation on newlines, handles parentheses, etc. The keybinding settings for enter (in keymap.cson) are important to get proper newlines with indentation at the right level. There are other helpers in init.coffee and keymap.cson that are useful for cutting, copying, pasting, deleting, and indenting Lisp expressions.

Install Atom

Download Atom

The Atom documentation is excellent. It's highly worth reading the flight manual.

@yamadayuki
yamadayuki / SampleComponent.js
Created June 19, 2016 14:58
Use keyframes property with React using inline style
import React from 'react';
import injectStyle from './path/to/injectStyle';
export default class SampleComponent extends React.Component {
constructor(props) {
super(props);
const keyframesStyle = `
@-webkit-keyframes pulse {
0% { background-color: #fecd6d; }
@Pustur
Pustur / daily-ui.md
Last active February 3, 2025 17:20
DailyUI – A list of every DailyUI design challenge

All DailyUI Challenges

  1. Sign Up
  2. Credit Card Checkout
  3. Landing Page (above the fold)
  4. Calculator
  5. App Icon
  6. User Profile
  7. Settings
  8. 404 page
@xem
xem / readme.md
Last active April 18, 2025 20:19
Maths & trigonometry cheat sheet for 2D & 3D games

Conventions

  • A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
  • lengths are in any unit (ex: pixels)
  • code snippets are in JavaScript

Degrees to radians

angleRad = angleDeg * Math.PI / 180;

@bitwalker
bitwalker / config.ex
Created July 19, 2016 23:00
Useful config wrapper for Elixir
defmodule Config do
@moduledoc """
This module handles fetching values from the config with some additional niceties
"""
@doc """
Fetches a value from the config, or from the environment if {:system, "VAR"}
is provided.
An optional default value can be provided if desired.
@kritollm
kritollm / web-animations.d.ts
Last active October 3, 2017 09:06
Typescript definition file for the web animations api, in progress.
// UPDATE: The types is ready. npm install @types/web-animation-js
// I leave this as an refference for the w3c specs
// I coldn't find any definition file. This is a work in progress and it's my first d.ts file so the gist will be updated.
// The latest spec and the latest web-animations-js polyfill isn't compatible, so I will try to make it more web-animations-js compatible.
interface DocumentTimelineOptions {
originTime: DOMHighResTimeStamp;
}
declare type FillMode = "none" | "forwards" | "backwards" | "both" | "auto";
declare type IterationCompositeOperation = "replace" | "accumulate";