Skip to content

Instantly share code, notes, and snippets.

View PriteshJain's full-sized avatar
☠️
Destructuring Requirements

Pritesh Jain PriteshJain

☠️
Destructuring Requirements
View GitHub Profile
@PriteshJain
PriteshJain / Gemfile
Created September 10, 2012 19:14
rack server with sprockets and less compressor
source 'https://rubygems.org'
gem "sprockets"
gem "sprockets-less"
gem "less"
gem 'therubyracer'
#This file is created to easily install all required gems at once with dependencies

Changes:

  • this version includes backport of Greg Price's patch for speedup startup http://bugs.ruby-lang.org/issues/7158 .

    ruby-core prefers his way to do thing, so that I abandon cached-lp and sorted-lf patches of mine.

  • this version integrates 'array as queue' patch, which improves performance when push/shift pattern is heavily used on Array.

    This patch is accepted into trunk for Ruby 2.0 and last possible bug is found by Yui Naruse. It is used in production* for a couple of months without issues even with this bug.

var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@PriteshJain
PriteshJain / rails_11776.rb
Last active January 3, 2016 02:59
rails#11776 AR::Store attributes inaccessible after destruction of object
gem 'activerecord', '=4.0.0' #Works Fine
# gem 'activerecord' , '=4.0.1' #CAUSES ActiveModel::MissingAttributeError: missing attribute: group_id
# gem 'activerecord', '=4.0.2' #CAUSES ActiveModel::MissingAttributeError: missing attribute: group_id
require 'active_record'
# require 'sqlite3'
require 'mysql2'
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Interpolator;
# updated from the original @ http://cheat.errtheblog.com/s/rspec_shoulda
# just a subset -- models -- is included here. I'll update this, and create cheat sheets for others, as I go along.
# I marked the ones I added with NEW and also added the links to the corresponding code, as I think it's useful.
# Any comments/corrections are welcome!
# ================= Data and Associations =======================
# https://github.com/thoughtbot/shoulda-matchers/tree/master/lib/shoulda/matchers/active_record
it { is_expected.not_to have_db_column(:admin).of_type(:boolean) }
it { is_expected.to have_db_column(:salary).
@PriteshJain
PriteshJain / trex.html
Created March 30, 2015 11:21
T-Rex game from Chrome offline mode. Download and open in Chrome browser (Runs only on Chrome)
<html i18n-values="dir:textdirection;lang:language" dir="ltr" lang="en"><head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0,
maximum-scale=1.0, user-scalable=no">
<title i18n-content="title">T-Rex Game</title>
<style>/* Copyright 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. */
a {
# 300 5 MIN
# 600 10 MIN
# 900 15 MIN
# 1800 30 MIN
# 2700 45 MIN
# 3600 1 HR
# 7200 2 HR
# 10800 3 HR
# 14400 4 HR
# 18000 5 HR
{
"Seti_ClosedFolder_dots": true,
"Seti_ClosedFolder_remove": true,
"Seti_ClosedFolder_same": true,
"Seti_SB_big": true,
"Seti_SB_bright": true,
"Seti_SB_med": true,
"Seti_pad_3": true,
"Seti_pad_5": true,
"Seti_rainbow": true,