Skip to content

Instantly share code, notes, and snippets.

View inadarei's full-sized avatar

Irakli Nadareishvili inadarei

View GitHub Profile
@inadarei
inadarei / ultimate-ut-cheat-sheet.md
Created November 30, 2017 15:33 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies


@inadarei
inadarei / text.md
Last active August 29, 2015 14:15 — forked from awinder/text.md

Building Secure Networks with Vyatta on SoftLayer

What is Vyatta, and why would you want to use it?

  • Discussion of private vs public vnet and motivation - very briefly
  • The role/importance of VPN, Firewall and secure access - very briefly
  • Link to the open-source VyOS version and the commercial Vyatta project

Splitting your public and private traffic - spend most of your time here

@inadarei
inadarei / view.md
Last active December 31, 2015 09:59 — forked from mstade/view.md
/foo should be requested as Javascript. Most probably just a typo in the original.

Application views using HTTP trickery

If the client makes a request, let's say this is an initial request to a resource that the client knows nothing about. It goes along and does a little something like this:

GET /foo HTTP/1.1
Accept: text/html
Pragma: akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-get-nonces, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no
def disable_notifications!
auth_url = "https://twitter.com/login"
notifications_url = "https://twitter.com/settings/notifications"
agent = Mechanize.new
page = agent.get(auth_url)
puts "DISABLING NOTIFICATIONS for #{self.username}"
puts "Logging in..."
page.forms_with(:action => 'https://twitter.com/sessions') do |forms|
@inadarei
inadarei / node_debian_init.sh
Created September 24, 2012 03:20 — forked from peterhost/node_debian_init.sh
Daemon init script for node.js based app/server (DEBIAN/UBUNTU)
#!/bin/sh
# ------------------------------------------------------------------------------
# SOME INFOS : fairly standard (debian) init script.
# Note that node doesn't create a PID file (hence --make-pidfile)
# has to be run in the background (hence --background)
# and NOT as root (hence --chuid)
#
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts
# INSTALL/REMOVE http://www.debian-administration.org/articles/28
@inadarei
inadarei / gist:1975651
Created March 5, 2012 00:36 — forked from dhh/gist:1975644
Rails Mass Assignment Protection
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
@inadarei
inadarei / dateToArray.js
Created October 3, 2011 23:32 — forked from BigBlueHat/dateToArray.js
dateToArray - handy for emitting CouchDB keys based on dates
function dateToArray(ts, length, utc) {
var length = length || 6,
d = new Date(ts),
utc = Boolean(local) || true;
if (utc) {
return [d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds()].slice(0, length);
} else {
return [d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds()].slice(0, length);
}
@inadarei
inadarei / dso.search.js
Created September 15, 2011 18:20
dso.search
dso.search = function() {
var data = false;
var search = $('#search');
var template = _.template('<li><a href="<%=url%>"><span class="title"><%=title%></span><small><%=subtitle%></small><small class="date"><%=date%></small></a></li>');
var find = function(phrase) {
if (!data) return $.ajax({
url: '/search.json',
dataType: 'json',
success: function(resp) {
data = _(resp).chain()