Skip to content

Instantly share code, notes, and snippets.

View AlexTiTanium's full-sized avatar

Alex Kucherenko AlexTiTanium

View GitHub Profile
@AlexTiTanium
AlexTiTanium / stub.php
Created November 15, 2014 15:11
php simple stub object
<?php
class stub implements ArrayAccess, Countable, Iterator {
public $position = 0;
public function __get($name){
return new stub();
}
import base64
import hashlib
from Crypto import Random
from Crypto.Cipher import AES
"""
Cryptography helpers, used for cookie encryption by AES(Rijmen-128) encryption algorithm
"""

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

/**
* Created by alex on 03.03.14.
*/
/**
* Created by akucherenko on 21.10.13.
*/
define(['backbone', 'jquery', 'lodash', 'q'], function (Backbone, $, _, Q) {
/**
* ProjectModel class
<?php
/**
* Contact information
*/
public function defaultEvent()
{
$this->view->setTemplate('editAccount');
$form = new Form($this->getFormConfig('contactInfo'));
@AlexTiTanium
AlexTiTanium / showAllPortAndProcess
Last active December 28, 2015 01:29
Show all open port and pid
netstat -anltp | grep "LISTEN"
/**
* Start main render loop
*/
beginRenderToContainer: function(container){
// Prepare render
this.scene.defaultCamera.updateProjectionMatrix();
this.container = container;
this.clock.start();
(function () {
"use strict";
var Toolbox = window.Toolbox = {};
// `ctor` and `inherits` are from Backbone (with some modifications):
// http://documentcloud.github.com/backbone/
// Shared empty constructor function to aid in prototype-chain creation.
var ctor = function () {};
/**
* Gruntfile
*
* If you created your Sails app with `sails new foo --linker`,
* the following files will be automatically injected (in order)
* into the EJS and HTML files in your `views` and `assets` folders.
*
* At the top part of this file, you'll find a few of the most commonly
* configured options, but Sails' integration with Grunt is also fully
* customizable. If you'd like to work with your assets differently
/**
* Cross-Origin Resource Sharing (CORS)
*
* CORS is like a more modern version of JSONP-- it allows your server/API
* to successfully respond to requests from client-side JavaScript code
* running on some other domain (e.g. google.com)
* Unlike JSONP, it works with POST, PUT, and DELETE requests
*
* For more information on CORS, check out:
* http://en.wikipedia.org/wiki/Cross-origin_resource_sharing