Skip to content

Instantly share code, notes, and snippets.

@connor11528
connor11528 / app.js
Created April 2, 2015 18:31
Code to make a leaflet.js map the Angular Way. Comes from a tutorial: http://connorleech.ghost.io/how-to-use-the-angular-leaflet-directive/
var app = angular.module("mymapingapp", [
"leaflet-directive"
]);
app.controller('MainCtrl', ['$scope', function($scope) {
// make map
angular.extend($scope, {
san_fran: {
lat: 37.78,
lng: -122.42,
@connor11528
connor11528 / linkedlist.js
Created April 10, 2015 03:05
linked list javascript implementation
var Node = function(value){
var node = {};
node.value = value;
node.next = null;
return node;
};
var LinkedList = function(){
@connor11528
connor11528 / bandpage-getArtist.js
Last active August 29, 2015 14:24
Attempting to get information about Kelly Clarkson from the BandPage API
// Bandpage API
var BANDPAGE_APP_ID = '4945-------953728';
var BANDPAGE_API_KEY = '5ae045d8e3-------92177c69';
var BANDPAGE_API_SECRET = '055837ad8400---------058e7d1e3';
var BANDPAGE_BASE = 'https://api-read.bandpage.com/';
var request = require('request');
var kelly_clarkson_bid = '12334995322703872';
@connor11528
connor11528 / webDriverIntro.js
Created August 20, 2015 01:33
script to scrape songkick for upcoming concerts in the bay area
// script to get "Popular tickets in SF Bay Area" from songkick
//======
var fs = require('fs');
var cheerio = require('cheerio');
var webdriverio = require('webdriverio');
var options = { desiredCapabilities: { browserName: 'chrome' } };
var client = webdriverio.remote(options);
var outputPath = './results.json';
@connor11528
connor11528 / scraper.js
Created August 22, 2015 18:43
nutella-scraping-solution
var got = require('got');
var cheerio = require('cheerio');
var redditUrl = 'http://web.archive.org/web/20120216223019/http://www.reddit.com/r/science/';
var nextUrl = 'https://web.archive.org/web/20030910064848/http://www.ed.gov/index.jhtml';
got(redditUrl, function(err, html){
var $ = cheerio.load(html);
@connor11528
connor11528 / create_laravel_app.sh
Created July 11, 2017 21:09
Create a new Laravel application
#!/bin/bash
laravel new $1
cd $1
composer install
yarn install
touch README.md
cp .env.example .env
git init
git add -A
@connor11528
connor11528 / S3_public_policy.json
Last active September 6, 2017 16:45
Paste in this S3 bucket permission policy for our WildRydes AWS application. The website is hosted on the internet so we want it publicly accessible to everyone!
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::YOUR_BUCKET_NAME/*"
}
]
@connor11528
connor11528 / requestUnicorn.js
Last active September 5, 2023 14:27
Lambda function for requesting a Unicorn to come pick us up. Part of the WildRydes AWS application
const randomBytes = require('crypto').randomBytes;
const AWS = require('aws-sdk');
const ddb = new AWS.DynamoDB.DocumentClient();
const fleet = [
{
Name: 'Bucephalus',
Color: 'Golden',
@connor11528
connor11528 / ssl-redirect.html
Created October 18, 2017 19:59 — forked from konklone/ssl-redirect.html
Force a quick redirect to HTTPS on Github Pages for your domain (and only your domain)
<script>
var host = "YOURDOMAIN.github.io";
if ((host == window.location.host) && (window.location.protocol != "https:"))
window.location.protocol = "https";
</script>
@connor11528
connor11528 / linearSearch.js
Created December 22, 2017 23:20
The linear search algorithm implemented in Javascript
function linearSearch(array, toFind){
for(let i = 0; i < array.length; i++){
if(array[i] === toFind) return i;
}
return -1;
}