I hereby claim:
- I am viveksoundrapandi on github.
- I am iamvivek (https://keybase.io/iamvivek) on keybase.
- I have a public key ASDG6zN7ypopbFRy62WHXPLvWx0rrBLRiW4jfZ19MF9VbAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# frozen_string_literal: true | |
class Proc | |
def my_curry | |
# when my_curry is called: create a new proc and return | |
curried = proc do |*partial_args| | |
# when curried proc is called: create a closure with partial arguments and then return a new proc/lambda | |
l = lambda do |*remaining_args| | |
# when the partial rendered curried lambda is called delegate the call to original lambda with closure + current arguments | |
actual_args = partial_args + remaining_args |
From: proc.c (C Method): | |
Owner: Proc | |
Visibility: public | |
Number of lines: 19 | |
static VALUE | |
proc_curry(int argc, const VALUE *argv, VALUE self) | |
{ | |
int sarity, max_arity, min_arity = rb_proc_min_max_arity(self, &max_arity); | |
VALUE arity; |
const puppeteer = require('puppeteer'); | |
// Entry point to begin the flow | |
const scrapeImages = async (movie_details) => { | |
console.log(`Initiating ticket booking for ${movie_details.username}`); | |
// launch the chrome broser | |
const browser = await puppeteer.launch( { headless: false, dumpio: true, args: ['--no-sandbox']}); | |
// Open a new Tab | |
const page = await browser.newPage(); | |
// Visit our target website | |
await page.goto('https://www.jazzcinemas.com/Customer/Login'); |
def __getattr__(self, name): | |
# EX: delegates = [("q", "enqueue", "append")] | |
#iterate through to delegate items | |
for attr in self.delegates: | |
#check if the current lookedup attribute is in any of the delegates | |
if name == attr[1] and hasattr(getattr(self, attr[0]), attr[2]): | |
#delegate the call to composed object | |
return getattr(getattr(self, attr[0]), attr[2]) | |
#raise AttributeError to mimick system default | |
raise AttributeError("'{}' object has no attribute '{}'".format(type(self).__name__, name)) |
class Forwardable(object): | |
def __init__(self, *args, **kwargs): | |
self._delegates = [] | |
return super().__init__(*args, **kwargs) | |
@property | |
def delegates(self): | |
return self._delegates | |
@delegates.setter |
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env bash | |
################################## | |
# Install command line dev tools # | |
################################## | |
/usr/bin/xcode-select -p > /dev/null 2>&1 | |
if [ $# != 0 ]; then | |
xcode-select --install | |
sudo xcodebuild -license accept | |
fi |
for %f in (*.txt) do type "%f" >> output.txt |
from shutil import make_archive | |
from django.core.servers.basehttp import FileWrapper | |
def download(request,file_name=""): | |
""" | |
A django view to zip files in directory and send it as downloadable response to the browser. | |
Args: | |
@request: Django request object | |
@file_name: Name of the directory to be zipped | |
Returns: | |
A downloadable Http response |