Skip to content

Instantly share code, notes, and snippets.

View DarrylD's full-sized avatar
💭
daydreaming

Darryl D. DarrylD

💭
daydreaming
View GitHub Profile
@jayj
jayj / flexbox.less
Last active November 20, 2023 04:51
CSS3 Flexbox - LESS Mixins
// --------------------------------------------------
// Flexbox LESS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
// flex or inline-flex
.flex-display(@display: flex) {
display: ~"-webkit-@{display}";
display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active April 11, 2024 07:57
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@mohsen1
mohsen1 / reactor.js
Last active January 15, 2022 21:57
Reactor Pattern in JavaScript
function Event(name){
this.name = name;
this.callbacks = [];
}
Event.prototype.registerCallback = function(callback){
this.callbacks.push(callback);
}
function Reactor(){
this.events = {};
@mharsch
mharsch / gist:5188206
Last active February 8, 2024 02:43
serve HLS (HTTP Live Streaming) content from node.js

HLS streaming from node

Provided that you already have a file or stream segmenter generating your .m3u8 playlist and .ts segment files (such as the ffmpeg 'hls' muxer), this little node server will serve up those files to an HLS compatible client (e.g. Safari). If you're using node for your streaming app already, this obviates the need to serve the HLS stream from a separate web server.

loosely based on https://gist.github.com/bnerd/2011232

// loosely based on https://gist.github.com/bnerd/2011232
// requires node.js >= v0.10.0
// assumes that HLS segmenter filename base is 'out'
// and that the HLS playlist and .ts files are in the current directory
@Bunkerbewohner
Bunkerbewohner / guid.js
Created June 27, 2013 12:19
Generating a GUID for javascript applications and storing it in HTML5 local strorage.
function generate_guid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
}
function get_guid() {
if (window.localStorage.guid != null) {
@rjeczalik
rjeczalik / toggle-camera.bash
Created January 5, 2014 12:32
load/unload AppleCameraInterface
#!/usr/bin/env bash
toggle-camera() {
if kextstat | grep AppleCameraInterface &>/dev/null; then
for ((i=0; i<3; i++)); do
if sudo kextunload /System/Library/Extensions/AppleCameraInterface.kext &>/dev/null; then
echo "toggle-camera: AppleCameraInterface unloaded"
return 0
fi
done
##
# Creates an alias called "git hist" that outputs a nicely formatted git log.
# Usage is just like "git log"
# Examples:
# git hist
# git hist -5
# git hist <branch_name>
# git hist <tag_name> -10
##
git config --global alias.hist "log --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(red)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --graph --date=short"
@staltz
staltz / introrx.md
Last active April 18, 2024 15:33
The introduction to Reactive Programming you've been missing
@wh1tney
wh1tney / deploy-static-site-heroku.md
Last active July 2, 2023 17:33
How to deploy a static website to Heroku

Gist

This is a quick tutorial explaining how to get a static website hosted on Heroku.

Why do this?

Heroku hosts apps on the internet, not static websites. To get it to run your static portfolio, personal blog, etc., you need to trick Heroku into thinking your website is a PHP app. This 6-step tutorial will teach you how.

Basic Assumptions

@jiaaro
jiaaro / hotkey_helpers.js
Last active February 27, 2023 22:01
Mac Automation – Javascript (JSX) Hotkey helpers
// How to use:
// 1. Open "Script Editor" (requires OS X 10.10 Yosemite)
// 2. Change the language from "AppleScript" to "JavaScript"
// 3. Paste the code below and replace the safari example.
//
// More info:
// https://developer.apple.com/library/mac/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/index.html
var sys_events = Application("System Events");