Skip to content

Instantly share code, notes, and snippets.

Aditya M adityamenon

Block or report user

Report or block adityamenon

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
@adityamenon
adityamenon / test.js
Created Mar 27, 2016
Suggested signup code on deepstream.io
View test.js
$scope.execSignup = function () {
var fullName = $scope.signupForm.FullName,
username = $scope.signupForm.Username,
password = $scope.signupForm.Password;
dsanon.on('error', function (err) {
console.log("Anonymous Deepstream connection error: ", err);
});
var newUserRecord = dsanon.record.getRecord("user/"+username)
@adityamenon
adityamenon / index.js
Last active Jan 4, 2016 — forked from PhilKershaw/gist:2171814
Simple example of using 2-legged OAuth in Node.js (requires node-oauth)
View index.js
var express = require('express');
var oauth = require('oauth');
var sys = require('sys');
var app = express.createServer();
var key = "[api-key]";
var secret = "[api-secret]";
var request = new oauth.OAuth(null, null, key, secret, '1.0', null, 'HMAC-SHA1');
app.get('/api-request', function(req, res){
request.get(
@adityamenon
adityamenon / petstore.yaml
Created Jul 30, 2015
The REAL Swagger Pet Store YAML
View petstore.yaml
# Google search for Swagger Petstore YAML returns a link to https://github.com/swagger-api/swagger-spec/blob/master/examples/v2.0/yaml/petstore.yaml
# But this isn't the full story. Got the output below by translating the JSON http://petstore.swagger.io/v2/swagger.json with http://jsontoyaml.com/
---
swagger: "2.0"
info:
description: "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters."
version: "1.0.0"
title: "Swagger Petstore"
termsOfService: "http://swagger.io/terms/"
contact:
@adityamenon
adityamenon / testTopiaTermextractor.py
Last active Aug 29, 2015
Testing out the Python topia termextract package.
View testTopiaTermextractor.py
#!/usr/bin/env python
from topia.termextract import extract
text = '''
My Career Objectives:
Build impactful applications.
Work on a diverse range of technologies and platforms.
Have fun doing it all.
View coding standards.md

We are gonna be using php5.5 , so upgrade your systems to that.

  1. http://laravel.com/docs/contributing#coding-guidelines , we follow these, along with PSR-0 and PSR-1.

  2. use Foo (aliasing) etc statements should start from the 3rd line. Each class that needs to be used in a namespace has to be aliased in a separate line.

  3. Aliasing is important. You shouldn't be using more than two Namespace Separators (\) in the code that you right in your classes. Try to restrict the count of those namespace separators to one.

  4. No accessing global namespace (ie, \Foo is not allowed, you need to alias the class Foo via use Foo). The only exception for this is php spl exception classes.

View coding standards.md

We are gonna be using php5.5 , so upgrade your systems to that.

  1. http://laravel.com/docs/contributing#coding-guidelines , we follow these, along with PSR-0 and PSR-1.

  2. use Foo (aliasing) etc statements should start from the 3rd line. Each class that needs to be used in a namespace has to be aliased in a separate line.

  3. Aliasing is important. You shouldn't be using more than two Namespace Separators (\) in the code that you right in your classes. Try to restrict the count of those namespace separators to one.

  4. No accessing global namespace (ie, \Foo is not allowed, you need to alias the class Foo via use Foo). The only exception for this is php spl exception classes.

@adityamenon
adityamenon / app.domainname
Last active Aug 19, 2019
My preferred configuration for a Laravel 4 API endpoint running over PHP-FPM, when I need to talk to it with AngularJS.
View app.domainname
server {
root /path/to/app/public;
index index.php;
server_name test.dev;
set $cors_headers "whatever-custom-headers,you-would-like";
# redirection to index.php
location / {
try_files $uri $uri/ /index.php?$query_string;
@adityamenon
adityamenon / Default (linux).sublime-keymap
Created Aug 5, 2013
My Sublime Text 3 settings. Nothing fancy.
View Default (linux).sublime-keymap
[
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" },
{ "keys": ["shift+delete"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },
]
@adityamenon
adityamenon / upload_controller.php
Created Jul 31, 2012
Codeigniter upload a dynamic number of files
View upload_controller.php
<?php if(!defined('BASEPATH')) exit("No direct script access allowed.");
class Upload_test extends CI_Controller {
public function index() {
if($this->input->post('submit')) {
$config['upload_path'] = BASEPATH.'../uploads';
$config['allowed_types'] = 'txt';
@adityamenon
adityamenon / .htaccess.example
Created Jul 2, 2012
.htaccess for CodeIgniter setups - remove index.php and other stuff
View .htaccess.example
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
### Canonicalize codeigniter URLs
# If your default controller is something other than
# "welcome" you should probably change this
# RewriteRule ^(home(/index)?|index(\.php)?)/?$ / [L,R=301]
You can’t perform that action at this time.