Skip to content

Instantly share code, notes, and snippets.

How To Create A New Question Type (wip)

  • add a new file in app/models/quiz_question/ that extends QuizQuestion::Base (or another question type)
  • extend the appropriate scoring functions:
    • stats
    • total_answer_parts
    • correct_answer_parts
    • incorrect_answer_parts
  • requires_manual_scoring?
/**
* Module dependencies
*/
var express = require('express');
var fs = require('fs');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
// img path
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Clash of Clans Auto Tool for Genymotion (VirtualBox Android VM)
"""
import os
import sys
import virtualbox
import subprocess
import cv2.cv as cv
@suplo
suplo / VisionApiFocusFix.java
Last active January 29, 2019 04:27 — forked from gregkorossy/VisionApiFocusFix.java
Mobile Vision API fix for missing autofocus feature
/*
* IF YOU WANT TO JUST ACCESS THE CAMERA INSTANCE SO THAT YOU CAN SET ANY OF THE PARAMETERS, VISIT THE FOLLOWING LINK:
* https://gist.github.com/Gericop/364dd12b105fdc28a0b6
*/
/**
* <p>
* Sets the Mobile Vision API provided {@link com.google.android.gms.vision.CameraSource}'s
* focus mode. Use {@link Camera.Parameters#FOCUS_MODE_CONTINUOUS_PICTURE} or
* {@link Camera.Parameters#FOCUS_MODE_CONTINUOUS_VIDEO} for continuous autofocus.
@suplo
suplo / custom_rules.xml
Last active September 1, 2015 02:18 — forked from Avinash-Bhat/custom_rules.xml
Automatic versioning in Android using Ant and Git
<?xml version="1.0" encoding="UTF-8"?>
<project name="application-custom">
<macrodef name="git" taskname="@{taskname}">
<attribute name="command" />
<attribute name="dir" default="" />
<attribute name="property" default="" />
<attribute name="taskname" default="" />
<attribute name="failonerror" default="on" />
<element name="args" optional="true" />
@suplo
suplo / virt-addr.sh
Created October 13, 2015 09:58 — forked from tensorfields/virt-addr.sh
Get a KVM guest's IP address
#!/bin/bash
# Returns the IP address of a running KVM guest VM
# Assumes a working KVM/libvirt environment
#
# Install:
# Add this bash function to your ~/.bashrc and `source ~/.bashrc`.
# Usage:
# $ virt-addr vm-name
# 192.0.2.16
#
@suplo
suplo / osx-for-hackers.sh
Created October 30, 2015 00:13 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox...
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@suplo
suplo / gist:811ce36f37f203434aa7bda18b9aa1f0
Created May 31, 2016 04:28 — forked from entaroadun/gist:1653794
Recommendation and Ratings Public Data Sets For Machine Learning

Movies Recommendation:

Music Recommendation:

@suplo
suplo / gist:e2388fe31e10ac537f480f80bffee633
Created August 8, 2016 00:12 — forked from rtrouton/gist:f92f263414aaeb946e54
Install Xcode command line tools on 10.7.x - 10.10.x. Tested on 10.7.5, 10.8.5, 10.9.5 and 10.10.2.
#!/bin/bash
# Installing the Xcode command line tools on 10.7.x or higher
osx_vers=$(sw_vers -productVersion | awk -F "." '{print $2}')
cmd_line_tools_temp_file="/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress"
# Installing the latest Xcode command line tools on 10.9.x or higher
if [[ "$osx_vers" -ge 9 ]]; then
@suplo
suplo / fix-homebrew-npm.md
Created August 22, 2016 00:41 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.