Skip to content

Instantly share code, notes, and snippets.

View kadikraman's full-sized avatar
💚

Kadi Kraman kadikraman

💚
View GitHub Profile
@kadikraman
kadikraman / Hello.elm
Last active October 20, 2015 10:24
Hello World in Elm
import Html exposing (text, h1)
main =
h1 [ ] [ text "Hello world!" ]
@kadikraman
kadikraman / Window.elm
Created October 20, 2015 10:19
Resize window in Elm
import Graphics.Element exposing (..)
import Window
area : (Int, Int) -> Int
area (w,h) =
w * h
windowArea : Signal Int
windowArea =
@kadikraman
kadikraman / Mailbox.elm
Created October 20, 2015 11:34
Mailboxes in Elm
import Html exposing (..)
import Html.Events exposing (..)
import Html.Attributes exposing (..)
view : Signal.Address String -> String -> Html
view address message =
div []
[ input
[ type' "string",
"""
Exports Issues from a specified repository to a CSV file
Uses basic authentication (Github username + password) to retrieve Issues
from a repository that username has access to.
INSTUCTIONS:
1. pip install requests
2. replace GITHUB_USER with your username
3. replace GITHUB_PASSWORD with your auth token (settings -> personal access tokens)
4. run as "python export_issues.py"
"""
/src
    /components
    /containers
    /actions
    /reducers
    /sagas
/src
    /components
        PureComponent1
            index.js
            index.spec.js
            style.css
        PureComponent2
            index.js
            index.spec.js
            style.css
/src
    /components
        /Component1
            index.js <— may be a pure component or a component wrapped in a container, the consumer doesn’t care anyway
            index.spec.js
        /Component2
        /Component3
    /reducers
        index.js
        /Reducer1
@kadikraman
kadikraman / arrayCopyReplace.js
Created April 25, 2017 15:43
JavaScript tips
/*
Replacing an item in an array without mutating it
*/
const old = [1, 2, 3, 4];
const new = Object.assign([], old, {0: 1000});
console.log(new);
// [1000, 2, 3, 4]
@kadikraman
kadikraman / requireBasedOnRegex.js
Last active June 22, 2017 10:01
(Webpack) require a bunch of files based on a regex
/*
Instead of
require('../../blah/stories.js');
require('../../blah/blah/stories.js');
...
*/
const req = require.context('../', true, /stories\.js$/);
function loadStories() {
@kadikraman
kadikraman / importAndExportFile.js
Created March 19, 2018 14:29
Import a file and immediately export
export { default as CircleAdd } from './icons/CircleAdd';
export { default as TagRemove } from './icons/TagRemove';