Skip to content

Instantly share code, notes, and snippets.

@rastating
rastating / create-react-component.js
Last active June 18, 2019 12:17
A script to create the boilerplate code for a new React.js component with a [Jest] spec file
#! /usr/bin/env node
# Usage: node create-react-component.js ComponentName
# Note: If a `components` directory does not exist in the current working directory, nothing will be created
const fs = require('fs')
const path = require('path')
const componentName = process.argv[2]
const componentPath = path.join(
'components',
componentName
@rastating
rastating / USNetflixHosts
Created November 27, 2013 22:04
A hosts file to use to access the US Netflix using the Unblock US service without using their DNS for all of your traffic.
# Hosts file to access US Netflix using Unblock US without their DNS.
67.216.222.61 movies.netflix.com
67.216.222.65 cbp-us.nccp.netflix.com
67.216.222.130 movies1.netflix.com
67.216.222.104 movies2.netflix.com
147.255.171.14 netflix.com
147.255.171.7 moviecontrol.netflix.com
69.197.181.166 api-global.netflix.com
67.216.222.83 api-us.netflix.com
147.255.227.2 api.netflix.com
@SabretWoW
SabretWoW / rspec_model_testing_template.rb
Last active March 7, 2024 03:56
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@almirsarajcic
almirsarajcic / steamid_conversion.php
Last active October 20, 2020 22:06
Functions used to convert 64bit Steam ID to 32bit and the other way around.
<?php
function convert_steamid_64bit_to_32bit($id)
{
$result = substr($id, 3) - 61197960265728;
return (string) $result;
}
function convert_steamid_32bit_to_64bit($id)
{
@jimsynz
jimsynz / rgb_spectrum.c
Created January 5, 2011 20:59
Arduino sketch to cycle an RGB LED through the colour spectrum.
const int redPin = 11;
const int greenPin = 10;
const int bluePin = 9;
void setup() {
// Start off with the LED off.
setColourRgb(0,0,0);
}
void loop() {