Skip to content

Instantly share code, notes, and snippets.

Avatar

Vishal Telangre vishaltelangre

View GitHub Profile
View README.md

Deploying Rails to Linode

Installing Ruby Enterprise Edition, Apache, MySQL, and Passenger for deploying Rails 3.0 applications.

Get a Linode, and set it up with Ubuntu 10.04 LTS so that you have till April 2013 to get updates. Once the Linode is formatted, boot it and continue on.

Set up an 'A' record in your DNS, pointing to the IP of your Linode. I'm using demo.napcs.com here.

Initial setup

View gist:5125262

Twitter公式クライアントのコンシューマキー

Twitter for iPhone

Consumer key: IQKbtAYlXLripLGPWd0HUA
Consumer secret: GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU

Twitter for Android

Consumer key: 3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for Google TV

Consumer key: iAtYJ4HpUVfIUoNnif1DA
View gist:5125438
require "nokogiri"
require "uri"
require "net/http"
UA = "Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/18.0 Firefox/18.0 FirePHP/0.7.1"
@cookie = {}
def request(address, method = :get, data = {})
uri = URI.parse(address)
http = Net::HTTP.new(uri.host, uri.port)
@vishaltelangre
vishaltelangre / dynamic_selector_name.scss
Last active Dec 15, 2015 — forked from nex3/gist:1163471
Setting selector name dynamically in SASS
View dynamic_selector_name.scss
@mixin active($selector) {
#{$selector} {
color:black;
}
}
#my-id {
@include active($selector: ".my-class")
}
View gist:5772520
[1, 1, 1, 1, 2, 2, 3].to_histogram
=> {1 => 3, 2 => 2, 3 => 1}
View snippet.js
/*
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/
* Better handling of scripts without supplied ids.
*
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
*/
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],
View jquery.waituntilexists.js
(function ($) {
/**
* @function
* @property {object} jQuery plugin which runs handler function once specified element is inserted into the DOM
* @param {function} handler A function to execute at the time when the element is inserted
* @param {bool} shouldRunHandlerOnce Optional: if true, handler is unbound after its first invocation
* @example $(selector).waitUntilExists(function);
*/
View konklone.advanced.conf
server {
listen 80;
server_name konklone.com;
return 301 https://$host$request_uri;
}
# optional: the 'spdy' at the end of the listen command below turns on SPDY support.
server {
listen 443 ssl spdy;
View pubsub-simple.js
var pubsub = {};
(function(q) {
var topics = {}, subUid = -1;
q.subscribe = function(topic, func) {
if (!topics[topic]) {
topics[topic] = [];
}
var token = (++subUid).toString();
topics[topic].push({
token: token,
@vishaltelangre
vishaltelangre / 100-local-citus.sql
Created Aug 9, 2020 — forked from marchelbling/100-local-citus.sql
Local Citus cluster setup — bis
View 100-local-citus.sql
-- user:
CREATE ROLE citus WITH NOSUPERUSER LOGIN IN ROLE pg_monitor;
-- database:
ALTER DATABASE citus SET citus.shard_replication_factor = 1;
ALTER DATABASE citus OWNER TO citus;
-- extensions:
CREATE EXTENSION IF NOT EXISTS "hll";
CREATE EXTENSION IF NOT EXISTS "topn";
You can’t perform that action at this time.