Skip to content

Instantly share code, notes, and snippets.

@frankfuu
frankfuu / file1.txt
Created February 2, 2015 03:29
Created via API
Demo
/**
* Incrementing listening count
* creating a new listen element if artistID is not present
**/
var artistID, userID;
if (!db.users.findAndModify({
query: { userID: userID, 'listen.artistID': artistID },
update: { $inc: { 'listen.$.count': 1 } },
@frankfuu
frankfuu / Chart.extension.js
Last active January 28, 2016 14:32
An alternative version of the chart type named Doughnut in Chart.js
(function () {
// An alternative version of the chart type Doughnut in Chart.js
Chart.types.Doughnut.extend({
name: "DoughnutAlt",
defaults: this.defaultConfig,
draw: function () {
Chart.types.Doughnut.prototype.draw.apply(this, arguments);
this.chart.ctx.fillStyle = 'black';
this.chart.ctx.textBaseline = 'middle';
Param(
[string]$pat,
[string]$url,
[string]$agentPrefix,
[string]$pool,
[string]$sourceDir,
[string]$tgtDirPrefix,
[int]$copies
)
Microsoft (R) Build Engine version 15.5.180.51428 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 1/08/2018 1:47:49 AM.
Project "D:\projects\MyTestSolution\MyTestWebApplication\MyTestWebApplication.csproj" on node 1 (default targets).
PrepareForBuild:
Creating directory "obj\Release\".
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
@frankfuu
frankfuu / cloudfront-set-useragent-for-crawlers.js
Created March 5, 2019 05:46
cloudfront-set-useragent-for-crawlers
'use strict';
exports.handler = (event, context, callback) => {
const request = event.Records[0].cf.request;
const headers = request.headers;
const uri = request['uri'];
const botPattern = "Googlebot\\/|Googlebot-Mobile|Googlebot-Image|Googlebot-News|Googlebot-Video|AdsBot-Google([^-]|$)|AdsBot-Google-Mobile|Mediapartners-Google|Mediapartners \\(Googlebot\\)|APIs-Google|bingbot";
var re = new RegExp(botPattern, 'i');
var userAgent = headers['user-agent'][0]['value'];
@frankfuu
frankfuu / revision.server.routes.js
Created April 21, 2020 08:35
comp5347 week 8 part 3
var express = require('express')
var controller = require('../controllers/revision.server.controller.js')
var model = require('../models/revision.js')
var router = express.Router()
console.log(controller.showTitleForm)
router.get('/', controller.showTitleForm)
router.get('/getLatest', controller.getLatest);
module.exports = router
@frankfuu
frankfuu / revision.server.routes.js
Created April 21, 2020 08:35
comp5347 week 8 part 3
var express = require('express')
var controller = require('../controllers/revision.server.controller.js')
var model = require('../models/revision.js')
var router = express.Router()
console.log(controller.showTitleForm)
router.get('/', controller.showTitleForm)
router.get('/getLatest', controller.getLatest);
module.exports = router
@frankfuu
frankfuu / bootstrapinvestsmart.ps1
Last active January 22, 2024 05:39
Sets up git, repo, iis, hostfiles and visual studio 2019
## Usage ##
# replace frankfu and xxxx with bitbucket username and pat token
# Measure-Command { iwr https://gist.githubusercontent.com/frankfuu/9494e83912db0009f8b82ef0f5f0285a/raw/bootstrapinvestsmart.ps1 -OutFile bootstrap.ps1; Set-ExecutionPolicy Bypass -Force; ./bootstrap.ps1 -cloneUrl "https://frankfu:[email protected]/investsmart/investsmart.git" | Out-Default}
## Descrription ##
# Installs visual studio, setups iis, clones investsmart repo, setups certificates, hosts files, iis websites and app pools and does a build
# Tested working 17/06/2020 and takes roughly 15mins on my St. Leonards internet connection with a VM running with 6 cores and 8gb ram takes about 13 minutes.
param([string]$cloneUrl)
@frankfuu
frankfuu / tsc-sdk-ios-ble-example.m
Created May 27, 2024 02:20
TSC iOS SDK BLE Example
// iOS SDK BLE Example
#include <TSCLIB/TSCLIB.h>
#include <CoreBluetooth/CoreBluetooth.h>
TSCLIB *lib = [TSCLIB new];
NSMutableArray* deviceList = [lib searchBLEDevice: 2];
for(int i=0;i<deviceList.count;i++)
{
//NSLog(@"peripheral\n%@\n",deviceList[i]);