Skip to content

Instantly share code, notes, and snippets.

Allen Bargi aziz

  • Gothenburg, Sweden
View GitHub Profile
@myshov
myshov / function_invocation.js
Last active Jun 5, 2020
11 Ways to Invoke a Function
View function_invocation.js
console.log(1);
(_ => console.log(2))();
eval('console.log(3);');
console.log.call(null, 4);
console.log.apply(null, [5]);
new Function('console.log(6)')();
Reflect.apply(console.log, null, [7])
Reflect.construct(function(){console.log(8)}, []);
Function.prototype.apply.call(console.log, null, [9]);
Function.prototype.call.call(console.log, null, 10);
@developit
developit / hydra-alias.md
Last active Feb 27, 2020
Alias to invoke Chrome Canary w/ tracing, for IRHydra
View hydra-alias.md

An Alias to run Chrome with tracing enabled

For Chrome Canary:

alias hydra='/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --no-sandbox --js-flags="--user-data-dir=/tmp/profile --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces"'

For regular ol' Chrome:

@pugson
pugson / webpack-idle-high-cpu.md
Last active Jul 5, 2019
How to fix Webpack's high CPU usage when idling
View webpack-idle-high-cpu.md

Webpack constantly at 20% CPU usage even when idle?

It usually happens after you upgrade Node on your system. Here's how to fix it:

  1. sudo rm -rf node_modules/
  2. Run yarn or npm install
  3. If you still use npm go for a walk or take a 10 minute break. If you use yarn, proceed to step 4.
  4. Run npm install fsevents even if you use yarn!
  5. That's it. Webpack should now work properly.

If the issue comes up again, repeat the steps.

View Readme.md

Minimum Viable Async with Node 6

With the release of Node 6.0.0, the surface of code that needs transpilation to use ES6 features has been reduced very dramatically.

This is what my current workflow looks like to set up a minimalistic and fast microservice using micro and async + await.

The promise

@tlrobinson
tlrobinson / giphy.sh
Created Mar 14, 2016
Command-line Giphy using iTerm2's imgcat (also requires curl and jq)
View giphy.sh
#!/bin/sh
tag="$(echo "$*" | sed 's/ /+/')"
random_api_url="http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=$tag"
gif_url="$(curl "$random_api_url" 2> /dev/null | jq '.data.image_url' -r)"
curl "$gif_url" 2> /dev/null | imgcat
View sanfrancisco-font.css
/** WARNING - USE AT OWN RISK */
/** IT IS AGAINST APPLE'S POLICY TO USE SF PRO FOR ANYTHING OTHER THAN iOS/tvOS/macOS/watchOS DESIGN & DEVELOPMENT */
/** https://sf.abarba.me/font.css */
/** https://sf.abarba.me/LICENSE.pdf */
/** 1. Copy/import this file into your main css/scss file */
/** 2. Change css font-family: to "SF Text", "SF Display" or "SF Mono" */
/** 3. Apply font-weight or italic to html elements */
/** THANK YOU */
@eyecatchup
eyecatchup / apple-meta-insanity.html
Created Feb 8, 2015
Insanity of Apple-specific meta tags..
View apple-meta-insanity.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Apple Meta Insanity</title>
<!--
APPLE WEB APP META TAGS
-->
@buren
buren / rails_web_console_param.rb
Last active Feb 13, 2016
Attach a rails web console to any page by adding ?web_console=
View rails_web_console_param.rb
# config/initializers/web_console.rb
WebConsoleBeforeAction = ->(controller) do
controller.console if controller.params[:web_console]
end
ApplicationController.before_action(WebConsoleBeforeAction) if defined?(WebConsole) && Rails.env.development?
# NOTE:
# For security reasons only do this in development.
@chris-rock
chris-rock / crypto-buffer.js
Last active May 14, 2020
Encrypt and decrypt buffers in nodejs
View crypto-buffer.js
// Part of https://github.com/chris-rock/node-crypto-examples
var crypto = require('crypto'),
algorithm = 'aes-256-ctr',
password = 'd6F3Efeq';
function encrypt(buffer){
var cipher = crypto.createCipher(algorithm,password)
var crypted = Buffer.concat([cipher.update(buffer),cipher.final()]);
return crypted;
View gist:9d750721d37af7507c45

This is all based on the [alpha release][1].

Properties

From the built-in help system:

For many settings, TextMate will look for a .tm_properties file in the current folder, and in any parent folders (up to the user’s home folder).

These are simple «setting» = «value» listings, where «value» is a format string in which other variables can be referenced.

You can’t perform that action at this time.