Skip to content

Instantly share code, notes, and snippets.

const xs = []
const scope = {}
for(scope.i = 0; scope.i < 3; ++scope.i) {
xs.push(() => console.log('scope.i is', scope.i))
}
xs.forEach(f => f())
const xs = []
for(var i = 0; i < 3; ++i) {
xs.push(() => console.log('i is', i))
}
xs.forEach(f => f())
@kenmori
kenmori / error Your lockfile.md
Last active December 4, 2023 14:58
error Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`

error Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`.

if you update your package.json only. and then run yarn install --frozen-lockfile

The above error show you on console.

it's say that you need to run just yarn install.

@pesterhazy
pesterhazy / ripgrep-in-emacs.md
Last active March 21, 2024 18:25
Using ripgrep in Emacs using helm-ag (Spacemacs)

Why

Ripgrep is a fast search tool like grep. It's mostly a drop-in replacement for ag, also know as the Silver Searcher.

helm-ag is a fantastic package for Emacs that allows you to display search results in a buffer. You can also jump to locations of matches. Despite the name, helm-ag works with ripgrep (rg) as well as with ag.

How

@mauvm
mauvm / Jasmine-and-Babel6.md
Created November 12, 2015 10:51
Jasmine ES6 run script for use with Babel 6
$ npm install --save babel-cli babel-preset-es2015
$ npm install --save-dev jasmine

.babelrc:

{
 "presets": ["es2015"]
class 💩💩💩💩 {
func 💩💩💩(😎: Int, 🐯: Int) -> Int {
return 😎 + 🐯;
}
}
let 🐔 = 3;
let 😥 = 🐔 + 2;
let 💩 = 💩💩💩💩();
print(💩.💩💩💩(🐔, 🐯:😥));
@jasny
jasny / flip.js
Created March 27, 2014 13:32
Turn text upside down with JavaScript
//this script is based on coding by Reverse Fad http://www.revfad.com
function flip() {
var result = flipString(document.f.original.value.toLowerCase());
document.f.flipped.value = result;
}
function flipString(aString) {
var last = aString.length - 1;
var result = new Array(aString.length)
for (var i = last; i >= 0; --i) {
var c = aString.charAt(i)
@aras-p
aras-p / preprocessor_fun.h
Last active April 28, 2024 15:25
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@roryf
roryf / DeliminatorSeparatedPropertyNamesContractResolver.cs
Created June 23, 2011 13:09
Snake case (underscore separated) property name resolver for Newtonsoft.Json library
public class DeliminatorSeparatedPropertyNamesContractResolver : DefaultContractResolver
{
private readonly string _separator;
protected DeliminatorSeparatedPropertyNamesContractResolver(char separator) : base(true)
{
_separator = separator.ToString();
}
protected override string ResolvePropertyName(string propertyName)