Skip to content

Instantly share code, notes, and snippets.

View oozzal's full-sized avatar
🇳🇵
learning

Uzzal Devkota oozzal

🇳🇵
learning
View GitHub Profile
@oozzal
oozzal / agar_skins_loop.js
Created October 31, 2016 07:12
Agario Change Skins Continuously
Array.prototype.random = function () {
return this[Math.floor((Math.random()*this.length))];
}
skins = ['poland', 'usa', 'china', 'russia', 'canada', 'australia', 'spain', 'brazil', 'germany', 'ukraine', 'france', 'sweden', 'chaplin', 'north korea', 'south korea', 'japan', 'united kingdom', 'earth', 'greece', 'latvia', 'lithuania', 'estonia', 'finland', 'norway', 'cia', 'maldivas', 'austria', 'nigeria', 'reddit', 'yaranaika', 'confederate', '9gag', 'indiana', '4chan', 'italy', 'ussr', 'bulgaria', 'tumblr', '2ch.hk', 'hong kong', 'portugal', 'jamaica', 'german empire', 'mexico', 'sanik', 'switzerland', 'croatia', 'chile', 'indonesia', 'bangladesh', 'thailand', 'iran', 'iraq', 'peru', 'moon', 'botswana', 'bosnia', 'netherlands', 'european union', 'taiwan', 'pakistan', 'hungary', 'satanist', 'qing dynasty', 'matriarchy', 'patriarchy', 'feminism', 'ireland', 'texas', 'facepunch', 'prodota', 'cambodia', 'steam', 'piccolo', 'ea', 'india', 'kc', 'denmark', 'quebec', 'ayy lmao', 'sealand', 'bait', 'tsarist russia',
@oozzal
oozzal / bootstrap-modal.js
Created March 13, 2016 08:12
Ember Simple Bootstrap Modal Component
import Ember from 'ember';
export default Ember.Component.extend({
didInsertElement: function() {
var self = this;
this.$('.modal')
.modal('show')
.on('hide.bs.modal', function() {
self.sendAction('onModalClose');
});
@oozzal
oozzal / ruby_setup.md
Created February 1, 2016 10:50 — forked from julionc/ruby_setup.md
Deploy Ruby On Rails on Ubuntu 14.04

Deploy Ruby On Rails on Ubuntu 14.04

Server: Nginx with Phusion Passenger

Ruby Version: 2.1.3

User System: deploy

User System

@oozzal
oozzal / array_sum.js
Created July 15, 2015 12:02
Recursive Array Sum in Javascript
function arraySum(arr) {
if(typeof arr == 'number') return arr;
return arr.filter(function(item) {
return Array.isArray(item) || Number.isFinite(item);
}).reduce(function(memo, item) {
return memo + arraySum(item);
}, 0);
}
var arr = [7,4,1, [3,true,2], 1, '123'];
alert(arraySum(arr));
@oozzal
oozzal / benchmark.rb
Last active August 29, 2015 14:18 — forked from aboltart/gist:f90cab21db56073ff947
Ruby Benchmarking Test Cases.
#===========================================
# 1. Benchmark
#
require 'benchmark'
Benchmark.bmbm do |x|
x.report ('<<') do
1_000_000.times do
one = 'one'
two = 'two'
@oozzal
oozzal / rails_resources.md
Last active August 29, 2015 14:13 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
@oozzal
oozzal / javascript_resources.md
Last active August 29, 2015 14:13 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@oozzal
oozzal / 0_reuse_code.js
Last active August 29, 2015 14:13
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
@oozzal
oozzal / engine.rb
Last active August 29, 2015 14:10
Java like interface in ruby.
require './engine_interface'
class Engine
def self.init_with_name name
new
@name = name
end
def start
puts "Starting"
Reset mysql password (MAC):
> mysql.server stop
> mysql.server start --skip-grant-tables
> mysql
> update mysql.user set Password=PASSWORD('new_password') WHERE User='root'