Skip to content

Instantly share code, notes, and snippets.

View lysenkooo's full-sized avatar
🏠
Remote

Denis Lysenko lysenkooo

🏠
Remote
View GitHub Profile
@g3d
g3d / gist:2709563
Last active February 7, 2024 15:21 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 29, 2024 08:12
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@simonkcleung
simonkcleung / drawingproxy.js
Created June 30, 2012 06:23
Canvas Drawing Proxy
function DrawingProxy(ctx){
"use strict";
setContext(ctx);
var lastMethod, History, slice=Array.prototype.slice;
Object.defineProperty(Main,"context",{get : function(){return ctx}, set : setContext});
Object.defineProperty(Main,"$",{get : $});
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active June 28, 2024 08:56
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@simonkcleung
simonkcleung / index.js
Created September 25, 2012 14:21
node.js websocket example
var server=require('websocket.js').createServer();
var chatroom=server.addApp('/chatroom');
chatroom.ondata=function(data,userName){
this.broadcast(data,userName);
}
chatroom.onclose=function(userName){
this.broadcast(userName+" disconnected.");
@frequent
frequent / custom_event
Created October 9, 2013 17:00
Custom Event handler for IE8+
var util = {};
/**
* IE8 compatible custom event listener
* @method listenToCustomEvents
* @param {string} eventName Event to listen for
* @param {method} callback Method to run on event
*/
util.listenToCustomEvents = function (event_name, callback) {
if (document.addEventListener) {
@omercs
omercs / Oauth2AzureActiveDirectoryRuby
Last active March 2, 2021 12:21
Oauth2 token from Azure Active Directory in Ruby on Rails project
require 'oauth2'
class WelcomeController < ApplicationController
# You need to configure a tenant at Azure Active Directory(AAD) to register web app and web service app
# You will need two entries for these app at the AAD portal
# You will put clientid and clientsecret for your web app here
# ResourceId is the webservice that you registered
# RedirectUri is registered for your web app
CLIENT_ID = 'b6a42...'
CLIENT_SECRET = 'TSbx..'
@skanev
skanev / rubocop.rb
Last active March 13, 2024 08:24
A Rubocop wrapper that checks only added/modified code
#!/usr/bin/env ruby
# A sneaky wrapper around Rubocop that allows you to run it only against
# the recent changes, as opposed to the whole project. It lets you
# enforce the style guide for new/modified code only, as opposed to
# having to restyle everything or adding cops incrementally. It relies
# on git to figure out which files to check.
#
# Here are some options you can pass in addition to the ones in rubocop:
#
@blelump
blelump / aws_signed_request_v4.rb
Last active December 8, 2022 15:51
Sample Ruby code to create AWS signed request version 4 (with request headers)
#Signing AWS Requests By Using Signature Version 4
#http://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html
require 'uri'
require 'openssl'
require 'net/http'
require 'cgi'
method = 'GET'
service = 'iam'
@ebidel
ebidel / object-observe-proxy-polyfill.js
Last active July 29, 2021 04:08
Object.observe() polyfill using ES6 Proxies (POC)
// An `Object.observe()` "polyfill" using ES6 Proxies.
//
// Current `Object.observe()` polyfills [1] rely on polling
// to watch for property changes. Proxies can do one better by
// observing property changes to an object without the need for
// polling.
//
// Known limitations of this technique:
// 1. the call signature of `Object.observe()` will return the proxy
// object. The original object needs to be overwritten with this return value.