Skip to content

Instantly share code, notes, and snippets.

View CyberLight's full-sized avatar
🎓
in training

Aleksandr Vishniakov CyberLight

🎓
in training
View GitHub Profile
Warden::Strategies.add(:bcrypt) do
def valid?
params[:username] || params[:password]
end
def authenticate!
return fail! unless user = User.first(:username => params[:username])
if user.encrypted_password == params[:password]
success!(user)
@CyberLight
CyberLight / easy_install_on_linux.sh
Last active August 29, 2015 14:08
best easy install chromedriver on linux
#For linux
sudo apt-get install unzip
wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/2.12/chromedriver_linux64.zip && sudo unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/;
sudo chown -R $(whoami):$(groups $(whoami) | cut -d' ' -f1) /usr/local/bin/chromedriver
@CyberLight
CyberLight / easy_install_on_mac.sh
Created October 30, 2014 05:23
best easy install chromedriver on mac
#For mac
brew install unzip
wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/2.12/chromedriver_mac32.zip && sudo unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/;
sudo chown -R $(whoami):$(groups $(whoami) | cut -d' ' -f1) /usr/local/bin/chromedriver
var Q = require("q");
var phantom=require('node-phantom');
function promisify(nodeAsyncFn, context, modifier) {
return function() {
var args = args = Array.prototype.slice.call(arguments);
var defer = Q.defer()
args.push(function(err, val) {
@CyberLight
CyberLight / httpRequest.py
Created December 24, 2014 03:56
httpRequest.py
from twisted.web.iweb import IBodyProducer
from twisted.internet import defer
from twisted.web.client import Agent
from twisted.web.http_headers import Headers
import urllib
class StringProducer(object):
implements(IBodyProducer)
def __init__(self, body):
import urllib2
def urlencode(s):
return urllib2.quote(s)
def urldecode(s):
return urllib2.unquote(s).decode('utf8')
@CyberLight
CyberLight / mixin.py
Last active August 29, 2015 14:13 — forked from cyberdelia/mixin.py
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.utils.cache import patch_response_headers
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page, never_cache
from django.views.decorators.csrf import csrf_exempt
class NeverCacheMixin(object):
@method_decorator(never_cache)
// For IE
.btn-inverse:active,
.btn-inverse.active {
background-color: #080808 \9;
}
// Add 'btn-flat' to your buttons
.btn-flat {
filter:progid:DXImageTransform.Microsoft.Gradient(enabled='false');
var oldSync = Backbone.sync;
Backbone.sync = function(method, model, options){
options.beforeSend = function(xhr){
xhr.setRequestHeader('X-CSRFToken', CSRF_TOKEN);
};
return oldSync(method, model, options);
};

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch