Skip to content

Instantly share code, notes, and snippets.

View rictorres's full-sized avatar
💅
startuppin'

Ricardo Torres rictorres

💅
startuppin'
View GitHub Profile
@rictorres
rictorres / appcache.php
Last active December 17, 2015 04:18
Function to generate appcache manifest file and to automatically update itself (using md5 hashes).
<?php
header('Content-Type: text/cache-manifest');
header('Cache-Control: no-cache');
echo "CACHE MANIFEST\n\n";
$hashes = "";
$blacklist = array(
@branneman
branneman / composition.js
Last active April 15, 2018 19:51
OO JavaScript: Inheritance vs. Composition
//
// hasPosition trait
//
const hasPosition = state => ({
setPosition: function(x, y) {
this.x = x;
this.y = y;
}.bind(state)
});
@branneman
branneman / skills.md
Last active August 23, 2020 20:47
Front-End Software Craftsmanship

JavaScript knowledge

  • Operators, operands, operator precedence (unary, binary, ternary)
  • Dynamic Type system: types and conversion
    • Value type vs. Reference type
  • Expression vs. Statement
  • Scope
  • Hoisting
  • Overloading
  • Prototypal inheritance vs. Classical inheritance
  • Instancing
@jpantuso
jpantuso / osx_lion_rail_setup.md
Created July 27, 2011 19:51
Setup OS X 10.7 w/ homebrew, oh-my-zsh, rvm, rails, and MySQL
@k3karthic
k3karthic / truncate_dynamodb.sh
Last active July 12, 2022 18:56
Truncate all keys in a dynamodb table
#!/bin/bash
TABLE_NAME=$1
# Get id list
aws dynamodb scan --table-name $TABLE_NAME | grep ID | awk '{ print $2 }' > /tmp/truncate.list
# Delete from id list
cat /tmp/truncate.list | xargs -IID aws dynamodb delete-item --table-name $TABLE_NAME --key '{ "id": { "S": "ID" }}'
@barneycarroll
barneycarroll / README.md
Last active August 29, 2022 12:02
Lock and unlock a page's scroll position.

jquery.scrollLock.js

Useful for when a blocking user experience is needed (in my case, didn't want people unwittingly loosing their place by scrolling while a modal required their attention): $.scrollLock() locks the body in place, preventing scroll until it is unlocked.

// Locks the page if it's currently unlocked
$.scrollLock();

// ...or vice versa
@carols10cents
carols10cents / javascript-to-rust-cheat-sheet.md
Last active October 28, 2023 07:57
JavaScript to Rust Cheat Sheet

JavaScript to Rust Cheat Sheet

The goal of this is to have an easily-scannable reference for the most common syntax idioms in JavaScript and Rust so that programmers most comfortable with JavaScript can quickly get through the syntax differences and feel like they could read and write basic Rust programs.

What do you think? Does this meet its goal? If not, why not?

Variables

JavaScript:

@jeneg
jeneg / lodashGetAlternative.js
Last active December 21, 2023 17:00
Alternative to lodash get method _.get()
function get(obj, path, def) {
var fullPath = path
.replace(/\[/g, '.')
.replace(/]/g, '')
.split('.')
.filter(Boolean);
return fullPath.every(everyFunc) ? obj : def;
function everyFunc(step) {
@btroncone
btroncone / ngrxintro.md
Last active February 9, 2024 15:37
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.