Skip to content

Instantly share code, notes, and snippets.

import { HTMLRewriter } from "https://ghuc.cc/worker-tools/html-rewriter/index.ts";
import { fetchConnectData } from "../../utilities/connect.js";
export default async (request, context) => {
const url = new URL(request.url);
const response = await context.next();
const location = context?.geo?.city;
const utm = url.searchParams.get("utm");
let rewriter;
import type { Context, Config } from "@netlify/edge-functions";
export default async (request: Request, context: Context) => {
const FIRST_VISIT_COOKIE = "has-visited";
const hasVisited = context.cookies.get(FIRST_VISIT_COOKIE);
if (!hasVisited) {
context.cookies.set({
name: FIRST_VISIT_COOKIE,
# Sub Account Query Script
# By Anil Bridpgal (abridgpal@)
# May 2020
# Instructions
# Update the API Key
# Change out the sub_account query, use https://api.newrelic.com/graphiql
@bridgpal
bridgpal / frontend-programming-design-resources.md
Created December 8, 2015 02:57 — forked from DrummerHead/frontend-programming-design-resources.md
List of Front-end, programming & design resources

Here is the Student Asessment

Mission Brief

Morning 007s.

Your mission, should you choose to accept it, is to identify and eliminate the hacker who breached our secure data centers.

class BooksController < ApplicationController
before_action :set_book, only: [:show, :update, :destroy]
respond_to :json
def index
respond_with Book.all
end
def create
respond_with Book.create(book_params)
@bridgpal
bridgpal / pivot.rb
Created August 5, 2014 19:24
Pivot Algorithm
input = [1, 4, 6, 3, 2]
def get_pivot(input=[])
1.upto(input.length-2) do |pivot|
left = input[0...pivot].inject(:+)
right = input[pivot+1..-1].inject(:+)
return pivot if left == right
end
return -1
end
# -*- encoding : utf-8 -*-
# config/deploy.rb
require 'capistrano/ext/multistage'
require "rvm/capistrano"
require 'bundler/capistrano' #Using bundler with Capistrano
require 'cape'
set :stages, %w(staging production)
set :default_stage, "production"

#Objective

###What are Blocks, Procs and Lambda?

  • Explain the differences between them
  • Ability to perform an action on each element of array using at least two methods

###Quick Review on Loops and Arrays

  • Loops
"use strict"
@ticTacToe = angular.module 'TicTacToe', []
ticTacToe.constant 'WIN_PATTERNS',
[
[0,1,2]
[3,4,5]
[6,7,8]
[0,3,6]