Skip to content

Instantly share code, notes, and snippets.

View nisanthchunduru's full-sized avatar

Nisanth Chunduru nisanthchunduru

View GitHub Profile
@nisanthchunduru
nisanthchunduru / gist:41c9f12b7aba091b6799
Last active August 28, 2015 11:49
Some CKEditor dependencies
// //= require ckeditor/dialogui
// //= require ckeditor/dialog
// //= require ckeditor/clipboard
class CommentCreated < Action
include WatchersToBeNotified
watchers_to_be_notified {
ticket_attr_reader :ticket
categories {
agents to_be_notified_if: :all_comments
user_assignees to_be_notified_if: :comment_assignment
group_assignees to_be_notified_if: :comment_group_assignment
describe RepoSynchronizationJob do
it 'sets refreshing_repos to true before synchronization' do
is_refreshing_repos_set_to_true = Proc.new do |user_id|
User.find(user_id).refreshing_repos == true
end
user = create(:user, refreshing_repos: false)
github_token = 'token'
expect(user.refreshing_repos).to be_false
flexmock(RepoSynchronization).should_receive(:call).with(FlexMock.on(&is_refreshing_repos_set_to_true), Flexmock.any).once
@nisanthchunduru
nisanthchunduru / feature.rb
Last active August 29, 2015 14:13
Simple Feature Flipper in Ruby
require 'mock_redis'
class Feature
class << self
attr_accessor :redis
end
def initialize(name)
@name = name
end
# ...
namespace :deploy do
desc 'Restart application'
task :restart => ["eye:reload", "eye:restart"]
after :published, :restart
end
@nisanthchunduru
nisanthchunduru / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@nisanthchunduru
nisanthchunduru / gist:5f3a13260e036755b37a
Last active August 29, 2015 14:18
TDD Demo BITS Goa
require 'ansi'
def puts_red(text)
puts ANSI.red { text }
end
def puts_green(text)
puts ANSI.green { text }
end
@nisanthchunduru
nisanthchunduru / myntra-challenge.hs
Last active August 29, 2015 14:18
Trying to solve Myntra's Challenge question to learn Haskell
-- Using http://www.learnyouahaskell.com/ as reference
data Coordinate = Coordinate Int Int deriving(Show, Eq)
data Direction = North | West | South | East deriving(Show, Eq)
data Position = Position Coordinate Direction deriving(Show, Eq)
instance Enum Direction where
toEnum 0 = North
toEnum 1 = East
toEnum 2 = South
@nisanthchunduru
nisanthchunduru / example.js
Last active August 29, 2015 14:19
Control position of toolbar buttons added by Redactor plugins
RedactorPlugins.fontcolor = function () {
init: function() {
// code
// Would be nice to have something like
this.registerButton(buttonKey, buttonTitle, buttonCallback, buttonDropDown)
// instead of
// this.buttonAdd(buttonKey, buttonTitle, buttonCallback, buttonDropDown)
// which just adds the button to the end of the toolbar

Installing pdnsd from homebrew as root user.

$ brew install pdnsd

$ sudo chown -R nobody /usr/local/var/cache/pdnsd

$ curl -L http://goo.gl/kMlyQ -o pdnsd.conf
$ mv pdnsd.conf /usr/local/etc
$ sudo chown root /usr/local/etc/pdnsd.conf