Skip to content

Instantly share code, notes, and snippets.

View thelebster's full-sized avatar
:octocat:
Do nothing, it is ok.

Anton Lebedev thelebster

:octocat:
Do nothing, it is ok.
View GitHub Profile
@thelebster
thelebster / API.md
Created February 6, 2014 08:59 — forked from iros/API.md

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

function ithra_softlayer_download_file($account, $fid) {
$file = db_select('ithra_softlayer_objectstorage', 'os')
->fields('os')
->condition('uid', $account->uid, '=')
->condition('fid', $fid, '=')
->execute()->fetchObject();
if (!$file) {
drupal_not_found();
<?php
error_reporting(E_ALL);
require realpath(dirname(__FILE__)) . '/Classes/PHPExcel.php';
$objPHPExcel = new PHPExcel();
// DEMO ONLY (potentially unsafe)
$data = json_decode($_POST['json']);
$key = $_POST['key'];
var User = require('../app/models/user');
var Auth = require('./middlewares/api_auth.js');
module.exports = function(app, passport){
app.get('/api/auth/fb', function(req, res, next) {
passport.authenticate('facebook-token', function(err, user, info) {
if (err) {
return next(err); // will generate a 500 error
/**
* Module dependencies.
*/
var express = require('express'),
fs = require('fs'),
http = require('http'),
path = require('path'),
mongoose = require('mongoose'),
passport = require("passport"),
/**
* Implements hook_views_default_views_alter()
*
* $handler =& $view->display['DISPLAY_ID']->handler;
*/
function MODULENAME_views_default_views_alter(&$views) {
if (isset($views['admin_views_node'])) {
$handler =& $views['admin_views_node']->display['default']->handler;
@thelebster
thelebster / smsaero_get_xls_reports.js
Created May 22, 2014 21:11
Get XLS reports from http://smsaero.ru/. Uses CasperJS - http://casperjs.org. Run script: casperjs smsaero.js --email=fakemail@fake.com --password=fakepassword
var casper = require('casper').create({
//verbose: true,
//logLevel: 'debug',
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22'
});
casper.cli.drop("cli");
casper.cli.drop("casper-path");
if (casper.cli.args.length === 0 && Object.keys(casper.cli.options).length === 0) {
# Start the old vagrant
$ vagrant init centos-6.3
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
# this machine, please update the guest additions and repackage the
# box.
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
<?php
/*
Make Sure you include:
ctools_include('modal');
ctools_modal_add_js();
On the pages you put your link.
*/