Skip to content

Instantly share code, notes, and snippets.

View dsignr's full-sized avatar

Neya dsignr

View GitHub Profile
@dsignr
dsignr / wp-comments-post.php
Last active June 2, 2018 13:02
PHP syntax example - Wordpress
<?php
/**
* Handles Comment Post to WordPress and prevents duplicate comment posting.
*
* @package WordPress
*/
if ( 'POST' != $_SERVER['REQUEST_METHOD'] ) {
$protocol = $_SERVER['SERVER_PROTOCOL'];
if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
$protocol = 'HTTP/1.0';
@dsignr
dsignr / express.js
Created June 3, 2018 07:36
JS syntax example
/**
* Module dependencies.
*/
var express = require('../../lib/express');
var verbose = process.env.NODE_ENV !== 'test'
var app = module.exports = express();
@dsignr
dsignr / express.js
Created June 3, 2018 07:36
JS syntax example
/**
* Module dependencies.
*/
var express = require('../../lib/express');
var verbose = process.env.NODE_ENV !== 'test'
var app = module.exports = express();
@dsignr
dsignr / example.scala
Created June 3, 2018 07:42
Scala syntax example
/*
* Copyright (C) 2009-2018 Lightbend Inc. <https://www.lightbend.com>
*/
package play.api.cache.caffeine
import java.util.concurrent.TimeUnit
import javax.inject.{ Inject, Provider, Singleton }
import javax.cache.CacheException
@dsignr
dsignr / gorilla.go
Created June 3, 2018 07:43
Go language syntax example
package mux
import (
"net/http"
"strings"
)
// MiddlewareFunc is a function which receives an http.Handler and returns another http.Handler.
// Typically, the returned handler is a closure which does something with the http.ResponseWriter and http.Request passed
// to it, and then calls the handler passed as parameter to the MiddlewareFunc.
@dsignr
dsignr / example.rb
Created June 3, 2018 07:48
Ruby syntax example
class DriveAPI
include HTTParty
base_uri 'https://www.googleapis.com'
#for debugging
debug_output $stdout
end
def create_file(file_name, parent_id)
check_token!
access_token = current_user.access_token
@dsignr
dsignr / example.py
Created June 3, 2018 07:52
Sample Python syntax example
# -*- coding: utf-8 -*-
"""
flask.globals
~~~~~~~~~~~~~
Defines all the global objects that are proxies to the current
active context.
:copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details.
"""
@dsignr
dsignr / example.ex
Created June 3, 2018 07:53
Sample Elixir code
defmodule AppName.IpnController do
@moduledoc """
IPN Controller.
"""
use AppName.Web, :controller
def create(conn, params) do
# PayPal requires the params returned in the exact order given.
# The map needs to be a list. encode/1 keep the order of a list,
@dsignr
dsignr / tutorial.md
Created July 17, 2018 15:24 — forked from swalkinshaw/tutorial.md
Designing a GraphQL API

Tutorial: Designing a GraphQL API

This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.

It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.

@dsignr
dsignr / install.md
Last active August 12, 2018 23:26 — forked from filipelinhares/install.md
Install Erlang, Elixir and Phoenix - Ubuntu and OSX

Install Erlang, Elixir and Phoenix

Ubuntu

Erlang

sudo apt-get install erlang

Elixir