Skip to content

Instantly share code, notes, and snippets.

View ClausClaus's full-sized avatar
😁
Happy coding

ClausClaus

😁
Happy coding
View GitHub Profile
@fr-ser
fr-ser / debounce.ts
Last active July 15, 2023 15:12
Typed debounce function wtih TypeScript
export function debounce<F extends Function>(func:F, wait:number):F {
let timeoutID:number;
if (!Number.isInteger(wait)) {
console.warn("Called debounce without a valid number")
wait = 300;
}
// conversion through any necessary as it wont satisfy criteria otherwise
return <any>function(this:any, ...args: any[]) {
@nodkz
nodkz / .babelrc.js
Last active March 25, 2024 16:16
Babel 7.0 with .babelrc.js DEPRECATED! This config was created when babel 7 was in beta
/* eslint-disable prefer-template */
const path = require('path');
const aliases = require('./aliases');
// ///////////////////////////////////////////////////////////////
// ////////////////// PLUGINS ////////////////////////////////
// ///////////////////////////////////////////////////////////////
const commonPlugins = [
@JonathanMH
JonathanMH / index.js
Created October 22, 2016 15:07
JSON Web Token Tutorial: Express
// file: index.js
var _ = require("lodash");
var express = require("express");
var bodyParser = require("body-parser");
var jwt = require('jsonwebtoken');
var passport = require("passport");
var passportJWT = require("passport-jwt");
@umidjons
umidjons / phpstorm-auto-semicolon-macro.txt
Last active July 26, 2022 11:11
PhpStorm: Record Auto semicolon macro and bind shortcut to it
Record Auto semicolon macro and bind shortcut to it:
1. Edit -> Macros -> Start Macro Recording
2. In the editor go to the end of line by pressing End
3. put semicolon ';'
4. Edit -> Macros -> Stop Macro Recording
5. Give a name, for example 'Auto semicolon'
6. Open settings (Ctrl + Alt + s), select Keymap
7. Expand Macros node
8. Select 'Auto semicolon', in the context menu choose Add Keyboard Shortcut
9. Set Ctrl + ; as First keystroke
@irazasyed
irazasyed / homebrew-permissions-issue.md
Last active April 24, 2024 17:07
Homebrew: Permissions Denied Issue Fix (OS X / macOS)

Homebrew Permissions Denied Issues Solution

sudo chown -R $(whoami) $(brew --prefix)/*

@joshbeckman
joshbeckman / animatedScrollTo.js
Created September 30, 2013 14:51
ScrollTo animation using pure javascript and no jquery
document.getElementsByTagName('button')[0].onclick = function () {
scrollTo(document.body, 0, 1250);
}
function scrollTo(element, to, duration) {
var start = element.scrollTop,
change = to - start,
currentTime = 0,
increment = 20;
@stephanschubert
stephanschubert / cross-browser-background-rgba.scss
Created April 18, 2011 05:44
SCSS mixin for cross-browser background-color: rgba(...). You'll need the Ruby extension for convenient color conversion rgba->hex (IE uses ARGB)
@mixin background-rgba($r,$g,$b,$a) {
// To mimic this in Internet Explorer, you can use the proprietary filter
// property to create a gradient with the same start and end color, along
// with an alpha transparency value.
@if experimental-support-for-microsoft {
$color: ie_hex($r,$g,$b,$a);
$value: unquote("progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=##{$color},endColorstr=##{$color})");
background-color: transparent\9;