Skip to content

Instantly share code, notes, and snippets.

View d30jeff's full-sized avatar
💭
Eating caviar and hacking famine

Deojeff d30jeff

💭
Eating caviar and hacking famine
View GitHub Profile
@d30jeff
d30jeff / day-1.js
Last active December 1, 2020 08:38
Advent Of Code - Day 1 2020
const fs = require('fs');
const readline = require('readline');
const NUMBERS = 3;
const readStream = fs.createReadStream('./input.txt');
const readInterface = readline.createInterface({
input: readStream,
});
@d30jeff
d30jeff / Dockerfile
Last active April 1, 2020 01:34
libvips libimagequant
FROM amazonlinux:2
# general build stuff
RUN yum update -y \
&& yum groupinstall -y "Development Tools" \
&& yum install -y wget tar
# libvips needs libwebp 0.5 or later and the one on amazonlinux2 is 0.3.0, so
# we have to build it ourselves
@d30jeff
d30jeff / commit-msg
Created August 14, 2018 18:07
Append branch name to commit message to make life easier
#!/usr/bin/env python
import sys, os, re
from subprocess import check_output
file_path = sys.argv[1]
# Get branch name
branch_name = check_output(['git', 'symbolic-ref', '--short', '-q', 'HEAD']).strip()
# Initialize prefix name
@d30jeff
d30jeff / angular.js
Created March 7, 2017 10:05
Weird Route
'use strict';
// Main App
angular.module('')
.config(function($stateProvider) {
$stateProvider
.state('dashboard', {
resolve: {
@d30jeff
d30jeff / half.php
Last active January 21, 2017 14:48
256 128 etc
<?php
$number = 256;
$arr = [];
while($number > 0) {
$arr[] = $number;
$number = $number >> 1;
}
@d30jeff
d30jeff / find_player.php
Last active December 29, 2016 15:44
No description
<?php
$value = 'deojeff';
$array = [
[
'tourney_id' => 1,
'player_1' => 'xxx',
'player_2' => 'yyy',
'player_3' => 'ttt',
@d30jeff
d30jeff / test.js
Last active November 28, 2016 17:35
window.onload = function() { alert(1); }
@d30jeff
d30jeff / main.js
Created November 4, 2016 13:47
Min Max
/**
* Get the smallest integer in an array.
* @param {Array} arr Array of numbers.
* @return {Integer} The smallest integer.
*/
function getMinimum(arr) {
var minValue = Infinity;
if (arr instanceof Array) {
for (var i = 0; i < arr.length; i++) {
@d30jeff
d30jeff / sort.js
Created October 25, 2016 04:58
Sorting
var shortArr = [1, 2, 3, 5, 4, 8, 7, 6];
var longArr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 22, 24, 23, 28, 27, 26, 25, 24, 22];
function reSortArray(arr) {
var limit = 20;
if (arr.length < limit) {
return arr.sort();
} else {
@d30jeff
d30jeff / custom.js
Created October 18, 2016 03:21
What is this front end bullshit
$(function() {
dropzoneBody.ondrop = function(e) {
e.stopPropagation();
e.preventDefault();
var self = this;
self.className = 'dropzone'; // adds the border placeholder
var file = e.dataTransfer.files[0];
var reader = new FileReader();