Skip to content

Instantly share code, notes, and snippets.

View ruddfawcett's full-sized avatar

Rudd Fawcett ruddfawcett

View GitHub Profile
@bnoguchi
bnoguchi / enum-access.js
Created May 3, 2011 09:19
How to access enumValues in mongoose from a Model or Document
var mongoose = require('./index')
, TempSchema = new mongoose.Schema({
salutation: {type: String, enum: ['Mr.', 'Mrs.', 'Ms.']}
});
var Temp = mongoose.model('Temp', TempSchema);
console.log(Temp.schema.path('salutation').enumValues);
var temp = new Temp();
console.log(temp.schema.path('salutation').enumValues);
@Jaybles
Jaybles / UIDeviceHardware.h
Created October 28, 2011 19:33
UIDeviceHardware - Determine iOS device being used
//
// UIDeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
@interface UIDeviceHardware : NSObject
- (NSString *) platform;
@paolorossi
paolorossi / html5-video-streamer.js
Created March 7, 2012 13:21
Node.js HTML5 video streamer
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
@grodtron
grodtron / recolor.bash
Created May 13, 2012 22:11
A bash/ImageMagick script to recolor transparent .png files
#!/bin/bash
# A small script to change the color of mono-colored transparent .pngs
#
# Uses ImageMagick to read the most common 100% alpha color and then computes
# scale factors to multiply the whole image by.
#
# Improvements to be made:
# -deal with images containing pure black.
# -make portable between new and old ImageMagick versions
@dmarx
dmarx / LinkFixerClone.py
Last active January 19, 2021 02:20
A simple LinkFixerBot clone developed as a demonstration for anyone who is curious how a simple reddit bot might be coded. To kill this code, spam "Ctrl+C" until it catches the exception.
import praw # simple interface to the reddit API, also handles rate limiting of requests
import re
from collections import deque
from time import sleep
USERNAME = "Your username here"
PASSWORD = "Your password here"
USERAGENT = "Your useragent string here. It should include your /u/username as a courtesy to reddit"
r = praw.Reddit(USERAGENT)
@tbrianjones
tbrianjones / free_email_provider_domains.txt
Last active July 8, 2024 00:56
A list of free email provider domains. Some of these are probably not around anymore. I've combined a dozen lists from around the web. Current "major providers" should all be in here as of the date this is created.
1033edge.com
11mail.com
123.com
123box.net
123india.com
123mail.cl
123qwe.co.uk
126.com
150ml.com
15meg4free.com
anonymous
anonymous / jsbin.iciyax.css
Created November 17, 2013 04:28
html {
/* background: url('https://dl.dropbox.com/u/45570283/TinyWings/images/backgroundImage.jpeg') no-repeat center center fixed; */
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
body {
background-color: #EEE;
@ruddfawcett
ruddfawcett / octicons.css
Created December 6, 2013 19:29
The @font-face for the GitHub Octicons. See https://github.com/styleguide/css/7.0 for more information.
@font-face {
font-family: 'Octicons';
src: url("https://a248.e.akamai.net/assets.github.com/fonts/octicons/octicons-regular-webfont.eot?ade8e027");
src: url("https://a248.e.akamai.net/assets.github.com/fonts/octicons/octicons-regular-webfont.eot?ade8e027#iefix") format("embedded-opentype")
, url("https://a248.e.akamai.net/assets.github.com/fonts/octicons/octicons-regular-webfont.woff?fca05081") format("woff")
, url("https://a248.e.akamai.net/assets.github.com/fonts/octicons/octicons-regular-webfont.ttf?b2778fb1") format("truetype")
, url("https://a248.e.akamai.net/assets.github.com/fonts/octicons/octicons-regular-webfont.svg?b5c3b089#newFontRegular") format("svg")
;
font-weight: normal;
font-style: normal;
@deandob
deandob / livestream
Created February 26, 2014 22:31
Node.JS function to remux mp4/h.264 video from an IP camera to a HTML5 video tag using FFMPEG
// Live video stream management for HTML5 video. Uses FFMPEG to connect to H.264 camera stream,
// Camera stream is remuxed to a MP4 stream for HTML5 video compatibility and segments are recorded for later playback
var liveStream = function (req, resp) { // handle each client request by instantiating a new FFMPEG instance
// For live streaming, create a fragmented MP4 file with empty moov (no seeking possible).
var reqUrl = url.parse(req.url, true)
var cameraName = typeof reqUrl.pathname === "string" ? reqUrl.pathname.substring(1) : undefined;
if (cameraName) {
try {
cameraName = decodeURIComponent(cameraName);
@viktorbezdek
viktorbezdek / jade_helper.md
Last active February 16, 2022 18:03
Jade - pass variable to base layout from extending template

layout.jade

doctype 5
html.no-js(lang='en')
block vars
head
  title #{title}
  meta(name='description', content='#{description}')
body