Skip to content

Instantly share code, notes, and snippets.

View skynode's full-sized avatar
💭
I may be slow to respond.

Obi skynode

💭
I may be slow to respond.
  • Amsterdam, The Netherlands
View GitHub Profile
var Sequelize = require('sequelize')
var db = new Sequelize('mydb', null, null, {
dialect: 'postgres'
})
var Post = db.define('post', {
id: {
type: Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true
@skynode
skynode / Associations.js
Created May 17, 2017 22:05 — forked from vsnikkil/Associations.js
Sequelize snippets
import User from './User'
import Session from './Session'
/* Associations */
User.hasMany(Session)
/* Hooks */
User.afterDestroy(async (user, options) => {
await Session.destroy({
where: { userId: user.id },
@skynode
skynode / BookUser.js
Created May 17, 2017 22:07 — forked from ericpkatz/BookUser.js
Sequelize Review
var expect = require('chai').expect;
var Sequelize = require('sequelize');
var db = new Sequelize('postgres://localhost/amazon_db');
var User = db.define('user', {
name: {
type: Sequelize.STRING,
allowNull: false
},
foo: {
@skynode
skynode / AccountsController.cs
Created June 20, 2017 01:46 — forked from happygrizzly/AccountsController.cs
ValidationSummaryMultipleForms
namespace project
{
// ...
public class AccountsController : Controller {
// ...
[HttpGet, Route("accounts/manage/change-passwords", Name="change-password")]
[Authorize(Roles="Admin")]
@skynode
skynode / schema.js
Created June 21, 2017 20:11 — forked from koistya/schema.js
How to create a Hacker News API with Node.js and GraphQL https://medium.com/p/3b13ef04ec0f
import { GraphQLSchema, GraphQLObjectType } from 'graphql';
import { nodeField, nodesField } from './types/Node';
import StoryType from './types/StoryType';
import UserType from './types/UserType';
import StoryMutations from './mutations/StoryMutations';
import CommentMutations from './mutations/CommentMutations';
export default new GraphQLSchema({
query: new GraphQLObjectType({
@skynode
skynode / git.gitignore
Created June 25, 2017 09:24
.gitignore files
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
@skynode
skynode / install_TensorFlow_on_Windows_10_Bash.md
Created June 25, 2017 11:34 — forked from wall72/install_TensorFlow_on_Windows_10_Bash.md
install TensorFlow on Windows 10 Bash (include graphiclib)

install TensorFlow on Windows 10 Bash (include graphiclib)

1. install packages

sudo apt-get update
sudo apt-get install -y --no-install-recommends \
        build-essential \
        libfreetype6-dev \
        libpng12-dev \
        libzmq3-dev \

Keybase proof

I hereby claim:

  • I am skynode on github.
  • I am skynode (https://keybase.io/skynode) on keybase.
  • I have a public key ASBoSMtTabQZR_8psQIWjT63BD3vxAkkXFViS9ZpmV4WJAo

To claim this, I am signing this object:

@skynode
skynode / es7-async-await.js
Created July 13, 2017 20:12 — forked from msmfsd/es7-async-await.js
Javascript fetch JSON with ES7 Async Await
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch
// async function
async function fetchAsync () {
// await response of fetch call
let response = await fetch('https://api.github.com');
// only proceed once promise is resolved
let data = await response.json();
// only proceed once second promise is resolved
@skynode
skynode / HttpClientExtensions.cs
Created October 5, 2017 00:44 — forked from alexandrevicenzi/HttpClientExtensions.cs
C# Post, Put and Patch as JSON async extensions
using System;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Threading.Tasks;
namespace MyProject.Extensions
{
public static class HttpClientEx
{
public const string MimeJson = "application/json";