Skip to content

Instantly share code, notes, and snippets.

View idkjs's full-sized avatar

Alain Armand idkjs

View GitHub Profile
@idkjs
idkjs / Dockerfile
Created February 17, 2017 10:40 — forked from dweinstein/Dockerfile
testProject
FROM ubuntu
MAINTAINER David Weinstein <david@bitjudo.com>
# install our dependencies and nodejs
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get -y install python-software-properties git build-essential
RUN add-apt-repository -y ppa:chris-lea/node.js
RUN apt-get update
RUN apt-get -y install nodejs
@idkjs
idkjs / gcloud-fish.sh
Created March 1, 2017 17:21 — forked from pierre-b/gcloud-fish.sh
Set fish shell for gcloud sdk on OSX
set fish_user_paths path_to_your_google_cloud_sdk/bin
set -x MANPATH path_to_your_google_cloud_sdk/help/man /usr/local/share/man /usr/share/man /opt/x11/share/man
@idkjs
idkjs / InstallationStack.md
Created March 8, 2017 19:12 — forked from pjnovas/InstallationStack.md
Complete Install on Ubuntu Server of Nodejs + MongoDB + NGINX

##Ubuntu Server

NodeJS

sudo apt-get install g++ curl libssl-dev apache2-utils git-core make
cd /usr/local/src
wget http://nodejs.org/dist/v0.10.28/node-v0.10.28.tar.gz
tar -xvzf node-v0.10.28.tar.gz
cd node-v0.10.28
@idkjs
idkjs / connection.js
Created March 25, 2017 12:18 — forked from mikberg/connection.js
MongoDB connection with async/await
import { MongoClient } from 'mongodb';
import promisify from 'es6-promisify';
let _connection;
const connect = () => {
if (!process.env.MONGO_CONNECTION_STRING) {
throw new Error(`Environment variable MONGO_CONNECTION_STRING must be set to use API.`);
}

agnostic modules

Most of the modules I write are "agnostic" in that they should work in Node, browserify, webpack, Rollup, jspm... hell, even Unreal.js. It's just ES5, CommonJS and a few quirks like process.nextTick or require('path') (which browserify and webpack will shim).

Other modules are a bit trickier, and need to include a static asset like HTML, GLSL or another file.

In Node you might see this:

var fs = require('fs')
@idkjs
idkjs / install-mongodb.md
Created April 29, 2017 16:39 — forked from adamgibbons/install-mongodb.md
Install MongoDB on Mac OS X 10.9

Install MongoDB with Homebrew

brew install mongodb
mkdir -p /data/db

Set permissions for the data directory

Ensure that user account running mongod has correct permissions for the directory:

@idkjs
idkjs / _usage.md
Created May 25, 2017 09:18 — forked from tbranyen/_usage.md
OpenWeatherMap / Weather Icons integration
  1. Include Weather Icons in your app: https://github.com/erikflowers/weather-icons

  2. Include the below JSON in your application, for example purposes, lets assume it's a global named weatherIcons.

  3. Make a request to OpenWeatherMap:

req = $.getJSON('http://api.openweathermap.org/data/2.5/weather?q=London,uk&callback=?');
@idkjs
idkjs / async-await.js
Created June 3, 2017 20:51 — forked from wesbos/async-await.js
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@idkjs
idkjs / recompose.jsx
Created June 10, 2017 22:10 — forked from stubailo/recompose.jsx
Using Recompose to manage variables in react-apollo
import React from 'react';
import { withState, pure, compose } from 'recompose';
import gql from 'graphql-tag';
import { graphql } from 'react-apollo';
import { Link } from 'react-router';
// The data prop, which is provided by the wrapper below, contains
// a `loading` key while the query is in flight, and the bookSearch
// results when they are ready
const BookSearchResultsPure = ({ data: { loading, bookSearch } }) => {
@idkjs
idkjs / Post.graphql
Created June 12, 2017 11:27 — forked from wmertens/Post.graphql
Imagining what a graphql schema would look like that allows auto-creating lists and detail view/editor
enum PostStates { DRAFT, PUBLISHED, ARCHIVED }
scalar Date
scalar Html
directive @buildIndex on field
directive @defaultFirst on field
#...etc
type PostContent {
brief: Html @editor(height: 150, wysiwyg: true)
extended: Html @editor(height: 400, wysiwyg: true)