Skip to content

Instantly share code, notes, and snippets.

View bobylito's full-sized avatar
🎩
JSing 🚀

Alex S bobylito

🎩
JSing 🚀
View GitHub Profile
@GiamPy5
GiamPy5 / selectHierarchicalMenu.js
Last active March 17, 2021 13:55
Hierarchical Tree Menu with Select Box (instantsearch)
var customMenuRenderFn = function (renderParams, isFirstRendering) {
var container = renderParams.widgetParams.container;
var title = renderParams.widgetParams.title;
var templates = renderParams.widgetParams.templates;
var cssClasses = renderParams.widgetParams.cssClasses || "";
var attributes = renderParams.widgetParams.attributes.map(function (attribute) {
return attribute.replace('.', '___');
});
var currentSelectedValue = null;
@tobyjsullivan
tobyjsullivan / abbreviateNum.js
Created May 31, 2017 00:57
Abbreviate large numbers in Javascript
// Iterated from: https://stackoverflow.com/questions/10599933/convert-long-number-into-abbreviated-string-in-javascript-with-a-special-shortn
function abbreviateNumber(value) {
let newValue = value;
const suffixes = ["", "K", "M", "B","T"];
let suffixNum = 0;
while (newValue >= 1000) {
newValue /= 1000;
suffixNum++;
}
@gbaman
gbaman / HowToOTGFast.md
Last active May 14, 2024 10:26
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)

More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH i

@mikaelbr
mikaelbr / 01-functional-ui.js
Last active February 21, 2017 23:50
Example of functional UI and higher order components for React/Omniscient.js (http://omniscientjs.github.io/)
import React from 'react';
import component from 'omniscient';
import immstruct from 'immstruct';
import { compose, valueNode, partialProps } from './compose';
const data = immstruct({ counter: 0, title: 'My title' });
const em = component(({partialedTitle, children}) =>
<em>{partialedTitle}: {children}</em>);
@hcooper
hcooper / koken-upload.py
Last active March 5, 2021 14:47
Upload photos to a koken gallery from the command line
# v1.0 of a command line uploader for the koken gallery software.
# The only non-standard requirement is pyton-requests.
import json
import requests
import os
from urllib import quote as quote
api_url = "http://yourdomain/api.php?"
common_headers = {'X-Koken-Auth':'cookie'}
@johanmeiring
johanmeiring / gist:3002458
Created June 27, 2012 08:32
"git lg" alias for pretty git log
# From http://garmoncheg.blogspot.com/2012/06/pretty-git-log.html
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"
@gasman
gasman / pnginator.rb
Created April 30, 2012 18:08
pnginator: pack Javascript into a self-extracting PNG
#!/usr/bin/env ruby -w
# pnginator.rb: pack a .js file into a PNG image with an HTML payload;
# when saved with an .html extension and opened in a browser, the HTML extracts and executes
# the javascript.
# Usage: ruby pnginator.rb input.js output.png.html
# By Gasman <http://matt.west.co.tt/>
# from an original idea by Daeken: http://daeken.com/superpacking-js-demos
@gre
gre / easing.js
Last active May 17, 2024 03:33
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@francois2metz
francois2metz / walk.sh
Created October 24, 2011 21:34
Create a screenshot of a website for each commits in a git repository
#!/usr/bin/env sh
# Under WTPL 2
# https://github.com/AdamN/python-webkit2png
COMMITS=$(git log --format="%H" --reverse)
OUTPUT_DIR="/tmp"
i=0
for commit in ${COMMITS}
do