Skip to content

Instantly share code, notes, and snippets.

View ilyabrin's full-sized avatar
Go, JavaScript

Ilya Brin ilyabrin

Go, JavaScript
View GitHub Profile
@ilyabrin
ilyabrin / facebook_twitter_login.rb
Created November 7, 2011 09:47
Twitter, Facebook Login in Rails
def facebook_log_in
# Scenarios
# If the user is signed in and has no facebook uid we link the accounts
# If the user is not signed in we create an account for him.
# that's it. he is logged in for life.
if player_signed_in?
if current_player['fb_uid'].nil?
# Link accounts
puts "linking accounts"
<!DOCTYPE html>
<!-- Helpful things to keep in your <head/>
// Brian Blakely, 360i
// http://twitter.com/brianblakely/
-->
<head>
<!-- Disable automatic DNS prefetching.
<!DOCTYPE html>
<!-- Helpful things to keep in your <head/>
// Brian Blakely, 360i
// http://twitter.com/brianblakely/
-->
<head>
<!-- Disable automatic DNS prefetching.
@ilyabrin
ilyabrin / dabblet.css
Created April 24, 2012 00:42 — forked from chriscoyier/dabblet.css
Untitled
body {
font-family: sans-serif;
}
ul {
list-style: none
}
li {
background: slategrey;
<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.
// Skeleton jQuery plugin
function($)
{
$.fn.myPlugin = function( options )
{
// options.
$.fn.myPlugin.settings = $.extend( {}, $.fn.myPlugin.defaults, options );
// Go through the matched elements and return the jQuery object.

Deploy Rails 4 app with Dokku on DigitalOcean

Install dokku

First create a Ubuntu 13.04 x64 droplet on DigitalOcean Control Panel

Then ssh with root account, run this in termianl:

$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
class Integer
def to_a
arr = []
tmp = self
while tmp>0
arr << tmp%10
tmp /= 10
end
arr.reverse
end
class Array
def same?
uniq.length==1
end
end
x = 1
y = 2
z = 2
l = 2
require 'socket'
require 'base64'
Refresh = 1 # seconds to refresh image on server
screen_capture_command = 'screencapture -C -x tmp.png'
image = ''
latest = Time.now
server = TCPServer.new 3000
loop do