Skip to content

Instantly share code, notes, and snippets.

Tim Wisniewski timwis

Block or report user

Report or block timwis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@squarism
squarism / multiline.exs
Last active Apr 7, 2019
Multiline Anonymous Functions in Elixir
View multiline.exs
# Examples of Different Styles and Syntax
# legal / positive case / you can do these stuffs
# ---------------------------------------------------------------------------
# single line, nothing special
Enum.map(0...2, fn i -> IO.puts i end)
"""
0
1
@getify
getify / 1.md
Last active Jul 9, 2019
BetterPromise: a strawman experiment in subclassing Promise and "fixing" a bunch of its awkward/bad parts
View 1.md

Some things that are "better" with this BetterPromise implementation:

  • BetterPromise # then(..) accepts a BetterPromise (or Promise) instance passed directly, instead of requiring a function to return it, so that the promise is linked into the chain.

    var p = BetterPromise.resolve(42);
    
    var q = Promise.resolve(10);
    
    p.then(console.log).then(q).then(console.log);
@jpbecotte
jpbecotte / Vue-cli-3-Phoenix-1.3-HOWTO.md
Last active Aug 19, 2019
Vue-cli 3, Phoenix 1.3, a complete how-to
View Vue-cli-3-Phoenix-1.3-HOWTO.md

Introduction

I have been struggling to start a new project with Phoenix 1.3 and the new vue-cli 3 for Vue.js. There are tons of example already but none of them suited my needs, because:

  • I want to use the new Vue-cli to select the features that I want,
  • I do NOT want to setup Webpack (I know, what a shame!). The new Vue-cli includes the new vue-cli-service, which uses an instance of webpack-dev-server, so you don't have to import it manually in your project.
  • I do not want to use Brunch.

Create your Phoenix App

Assuming that you have Elixir and Phoenix 1.3 are both installed, let's build our new App.

@joepie91
joepie91 / .md
Last active Mar 20, 2019
Useful tools for working with NixOS
@mafintosh
mafintosh / npm-classic-config.sh
Last active Jun 21, 2018
Resets the npm defaults to how they used to be
View npm-classic-config.sh
npm config set loglevel http
npm config set progress false
npm config set package-lock false
npm config set save false
mkdir -p ~/.config/configstore/
printf '{"optOut": true,"lastUpdateCheck": 0}' > ~/.config/configstore/update-notifier-npm.json
@timwis
timwis / get-schema.sql
Last active May 4, 2017
Get postgres table schema including keys/constraints
View get-schema.sql
SELECT
cols.column_name,
cols.data_type,
cols.character_maximum_length,
cols.column_default,
cols.is_nullable::boolean,
constr.constraint_type,
pg_catalog.col_description(cls.oid, cols.ordinal_position::int)::jsonb
FROM
pg_catalog.pg_class cls,
@allejo
allejo / division.html
Last active Dec 2, 2016
Do division in Liquid templates with support for decimals
View division.html
{% capture whitespace %}
{% assign wholeNum = include.number | divided_by: include.divsor %}
{% assign remainder = wholeNum | times: include.divsor | minus: include.number | times: -1 %}
{% capture output %}{{ wholeNum }}.{% endcapture %}
{% for i in (1..include.decimals) %}
{% assign newNumer = remainder | times: 10 %}
{% assign workspace = newNumer | divided_by: include.divsor %}
{% assign remainder = workspace | times: include.divsor | minus: newNumer | times: -1 %}
@onjin
onjin / docker-compose.yml
Created Sep 5, 2016
example docker compose for postgresql with db init script
View docker-compose.yml
postgres:
image: postgres:9.4
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
@mcdougs
mcdougs / osmp-{Philly}-guidebook-philly.md
Last active Jan 27, 2016
Open Source Mentorship Program {Philadelphia} 2015: Organizers Guidebook
View osmp-{Philly}-guidebook-philly.md

The Open Source Mentorship Program is a partnership between Code for America brigades and Girl Develop It chapters. The "Summer of Open Source" was piloted in Philadelphia over the summer of 2014. Met with great excitement from the success of the experiment, CfA and GDI cemented the partnership so that other brigades and chapters across the country might replicate and extend the impact of this collaboration.

In the summer of 2015, Philadelphia once again launched osmp. This guidebook is the result of their experience and includes both successes and opportunities for improvement. It is as comprehensive as possible, but the intention is for subsequent programs to fork and bu

@joepie91
joepie91 / promises-reading-list.md
Last active Dec 5, 2018
Promises (Bluebird) reading list
View promises-reading-list.md

Promises reading list

This is a list of examples and articles, in roughly the order you should follow them, to show and explain how promises work and why you should use them. I'll probably add more things to this list over time.

This list primarily focuses on Bluebird, but the basic functionality should also work in ES6 Promises, and some examples are included on how to replicate Bluebird functionality with ES6 promises. You should still use Bluebird where possible, though - they are faster, less error-prone, and have more utilities.

I'm available for tutoring and code review :)

You may reuse all gists for any purpose under the WTFPL / CC0 (whichever you prefer).

You can’t perform that action at this time.