Skip to content

Instantly share code, notes, and snippets.

View VehpuS's full-sized avatar
🦔

Moshe Jonathan Gordon Radian VehpuS

🦔
View GitHub Profile
@larryfox
larryfox / LICENSE.txt
Last active February 22, 2022 21:27
Determine if an elements background color is light or dark!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2015 Larry Fox <http://larryfox.us>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@89465127
89465127 / argparse_files.py
Last active August 27, 2022 14:24
Get a list of filenames using argparse (updated to use default formatter)
import argparse
import os
import glob
def main():
#Does not currently have support to read files from folders recursively
parser = argparse.ArgumentParser(description='Read in a file or set of files, and return the result.', formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('path', nargs='+', help='Path of a file or a folder of files.')
parser.add_argument('-e', '--extension', default='', help='File extension to filter by.')
args = parser.parse_args()
@nichtich
nichtich / README.md
Last active June 6, 2024 02:05 — forked from oodavid/README.md
How to automatically deploy from GitHub

Deploy your site with git

This gist assumes:

  • you have an online remote repository (github / bitbucket etc.)
  • you have a local git repo
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by Apache
  • the Apache user is named www-data (may be apache on other systems)
@willurd
willurd / web-servers.md
Last active June 13, 2024 14:37
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@oroce
oroce / package.json
Created April 25, 2014 08:42
run eslint only on changed (*.js files) files using pre-commit
{
"scripts": {
"eslint": "LIST=`git diff-index --name-only HEAD | grep .*\\.js | grep -v json`; if [ \"$LIST\" ]; then eslint $LIST; fi"
},
"devDependencies": {
"pre-commit": "0.0.7",
"eslint": "~0.5.1"
},
"pre-commit": [
"eslint"
@tylerneylon
tylerneylon / json.lua
Last active May 15, 2024 12:57
Pure Lua json library.
--[[ json.lua
A compact pure-Lua JSON library.
The main functions are: json.stringify, json.parse.
## json.stringify:
This expects the following to be true of any tables being encoded:
* They only have string or number keys. Number keys must be represented as
strings in json; this is part of the json spec.
@robertobarreda
robertobarreda / quantile.py
Last active December 28, 2021 13:02
Python Implementation of Graham Cormode and S. Muthukrishnan's Effective Computation of Biased Quantiles over Data Streams in ICDE’05 (https://github.com/matttproud/python_quantile_estimation)
#!/usr/bin/python
"""
Copyright 2013 matt.proud@gmail.com (Matt T. Proud)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@bellbind
bellbind / binding.gyp
Last active March 22, 2021 16:16
[nodejs]Making native package for node.js-4.x with nan-2.0
# -*- mode: python -*-
{
"targets": [
{
"include_dirs": ["<!(node -e \"require('nan')\")"],
"target_name": "NanExample",
"sources": [
"nan-example.cc"
],
"conditions": [
@christopherlovell
christopherlovell / display.py
Last active November 18, 2023 22:22
display youtube video in jupyter notebook
from IPython.display import HTML
# Youtube
HTML('<iframe width="560" height="315" src="https://www.youtube.com/embed/S_f2qV2_U00?rel=0&amp;controls=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>')
# Vimeo
HTML('<iframe src="https://player.vimeo.com/video/26763844?title=0&byline=0&portrait=0" width="700" height="394" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe><p><a href="https://vimeo.com/26763844">BAXTER DURY - CLAIRE (Dir Cut)</a> from <a href="https://vimeo.com/dannysangra">Danny Sangra</a> on <a href="https://vimeo.com">Vimeo</a>.</p>')
@veltman
veltman / README.md
Last active March 2, 2021 12:45
Swoopy arrows along a path

Animating arrows along an arbitrary path. Basically a combination of Seamless animated dash and Animating along a path - tweens the stroke-dashoffset on a loop and computes the translate/rotation of the arrowheads at the same time. Performance is not great, especially in Firefox...

See also: Directional arrows