Skip to content

Instantly share code, notes, and snippets.

@jonasfj
jonasfj / rAF.js
Last active December 10, 2015 13:08 — forked from paulirish/rAF.js
A list-based fallback implementation of `requestAnimationFrame` that reduces the number of `setTimeout`s needed.
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller
// fixes from Paul Irish and Tino Zijdel
// list-based fallback implementation by Jonas Finnemann Jensen
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@pafnuty
pafnuty / google_old.css
Created March 15, 2014 08:49
Возвращаем старый вид поисковой выдачи гугла
/*
Вставляем этот код в usercss браузера
плагинов полно, я рекомендую user css от dimox.name
https://chrome.google.com/webstore/detail/user-css/okpjlejfhacmgjkmknjhadmkdbcldfcb - хром
addons.opera.com/ru/extensions/details/user-css/ - Opera Next
*/
#ires h3 a {
text-decoration: underline;
font-size: 16px;
@ThisIsMissEm
ThisIsMissEm / handler.js
Created November 25, 2014 18:53
The better way to execute Go on Amazon Lambda (see: http://blog.0x82.com/2014/11/24/aws-lambda-functions-in-go/)
var child_process = require('child_process');
exports.handler = function(event, context) {
var proc = spawn('./test', [ JSON.stringify(event) ], { stdio: 'inherit' });
proc.on('close', function(code){
if(code !== 0) {
return context.done(new Error("Process exited with non-zero status code"));
}
function html(strings, ...interpolations) {
return strings
.map((string, i) => {
let value = interpolations[i];
// 0 is falsy but a valid value in HTML
if (value === undefined || value === null || value === false) {
value = "";
}
// join arrays so they aren't stringified with commas
if (Array.isArray(value)) {
@h1ros
h1ros / 7zcat
Created February 3, 2020 16:46
zcat for 7zip
#!/bin/bash
# copy this file into /bin/zcat to a file called /bin/7zcat
PATH=${GZIP_BINDIR-'/bin'}:$PATH
exec 7z e -so -bd "$@" 2>/dev/null | cat
@adeluccar
adeluccar / gist:d105299f2d5af55e3e96f9b989e7eb48
Created August 8, 2017 22:50
How to Flatten the History of a Git Repository Safely
git checkout --orphan future-master
git add -A  # Add all files and commit them
git commit
git branch -D master  # Deletes the master branch
git branch -m master  # Rename the current branch to master
git push -f origin master  # Force push master branch to github
git gc --aggressive --prune=all     # remove the old files
@pie6k
pie6k / useShareForwardedRef.tsx
Created October 23, 2019 10:02
forwardRef hook
import React, { useRef, forwardRef, Ref, useEffect } from 'react';
import { TextInputProps, TextInput } from 'react-native';
import styled from 'styled-components/native';
interface Props extends TextInputProps {
showEditLabel?: boolean;
}
const Input = styled.TextInput``;
package nettimeout
import (
"net"
"time"
)
// Listener wraps a net.Listener, and gives a place to store the timeout
// parameters. On Accept, it will wrap the net.Conn with our own Conn for us.
type Listener struct {
@bvaughn
bvaughn / LICENSE.md
Last active November 9, 2023 07:13
Advanced example for manually managing subscriptions in an async-safe way using hooks

The MIT License (MIT)

Copyright © <year> <copyright holders>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell

@bensie
bensie / imagemagick.bash
Last active November 20, 2023 10:13
ImageMagick Static Binaries for AWS Lambda
#!/usr/bin/env bash
# Must be run on an Amazon Linux AMI that matches AWS Lambda's runtime which can be found at:
# https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html
#
# As of May 21, 2019, this is:
# Amazon Linux AMI 2018.03.0 (ami-0756fbca465a59a30)
#
# You need to prepend PATH with the folder containing these binaries in your Lambda function
# to ensure these newer binaries are used.