This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bar(object): | |
def __init__(self, bar='bar', *args, **kwargs): | |
self.bar = bar | |
super(Bar, self).__init__(*args, **kwargs) | |
class Foo(object): | |
def __init__(self, foo='foo', *args, **kwargs): | |
self.foo = foo | |
super(Foo, self).__init__(*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
factors = -> (n) { (1..n).select{|x| n % x === 0} } | |
prime = ->(n){ (factors === n) === [1,n] } | |
(1..).lazy.select(&prime).take(10).to_a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cwd=`pwd`;for repo in `find . -type d -name '.git'`; do repodir=`echo $repo | sed 's/\.git$//'`; echo "Checking: $repodir"; cd $repodir; git status -s; cd $cwd; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sleep (time, arg) { | |
console.log(`Sleep started for ${arg}...`); | |
return new Promise((resolve) => { | |
setTimeout(() => { | |
resolve(arg); | |
}, time); | |
}); | |
} | |
await sleep(1000, this.report.pagination.pageNumber) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_record' | |
require 'arel' | |
# Ruby-like syntax in AR conditions using the underlying Arel layer (Rails >= 3.0). | |
# | |
# What you would usually write like this: | |
# | |
# User.where(["users.created_at > ? AND users.name LIKE ?", Date.yesterday, "Mary"]) | |
# | |
# can now be written like this (note those parentheses required by the operators precedences): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --------------------------------------------------------------------------------------------------------------------- # | |
# Conversion of http://eslint.org/docs/rules/ to an actual .eslintrc file: | |
# Copied: 04/01/2015 | |
# Updated to yaml format: 05/15/2015 | |
# Copied by: Ely De La Cruz <elycruz@elycruz.com> | |
# --------------------------------------------------------------------------------------------------------------------- # | |
# --------------------------------------------------------------------------------------------------------------------- # | |
# Environemnt Types: | |
# --------------------------------------------------------------------------------------------------------------------- # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cluster = require('cluster'); | |
if (cluster.isWorker) { | |
console.log('Worker ' + process.pid + ' has started.'); | |
// Send message to master process. | |
process.send({msgFromWorker: 'This is from worker ' + process.pid + '.'}) | |
// Receive messages from the master process. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Parent | |
attr_accessor :a, :b | |
def initialize(a) | |
@a = a | |
end | |
private | |
def set_b | |
@b = 'b' | |
end | |
end |
NewerOlder