I hereby claim:
- I am viveksoundrapandi on github.
- I am iamvivek (https://keybase.io/iamvivek) on keybase.
- I have a public key whose fingerprint is 1FBF 6AE2 C596 E799 1AA1 7349 E9A6 7B04 F328 D4E2
To claim this, I am signing this object:
$(function(){ | |
var submitted = false; | |
//links having the below class will not trigger native widow | |
$(".cancel_submit").live('click',function (e){ | |
submitted=true; | |
}); | |
window.onkeydown = function(e){ | |
var key = e.keyCode ? e.keyCode : e.charCode ? e.charCode : false; | |
if (((e.ctrlKey || e.metaKey)&&key==82 )||key==116) | |
{ |
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 |
for %f in (*.txt) do type "%f" >> output.txt |
#!/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 |
I hereby claim:
To claim this, I am signing this object:
class Forwardable(object): | |
def __init__(self, *args, **kwargs): | |
self._delegates = [] | |
return super().__init__(*args, **kwargs) | |
@property | |
def delegates(self): | |
return self._delegates | |
@delegates.setter |
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)) |
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'); |
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; |
# 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 |