Skip to content

Instantly share code, notes, and snippets.

View diorahman's full-sized avatar

Dhi Aurrahman diorahman

  • Cokelatia
  • Bandung
View GitHub Profile
@anaisbetts
anaisbetts / stat-cache.js
Last active April 11, 2019 05:07
Make your Electron apps load faster, with this One Weird Trick
// Include this at the very top of both your main and window processes, so that
// it loads as soon as possible.
//
// Why does this work? The node.js module system calls fs.realpathSync a _lot_
// to load stuff, which in turn, has to call fs.lstatSync a _lot_. While you
// generally can't cache stat() results because they change behind your back
// (i.e. another program opens a file, then you stat it, the stats change),
// caching it for a very short period of time is :ok: :gem:. These effects are
// especially apparent on Windows, where stat() is far more expensive - stat()
// calls often take more time in the perf graph than actually evaluating the
@gorhill
gorhill / gist:ef1b62d606473c68d524
Last active February 16, 2023 21:17
Disqus comments widget: on-demand
! Title: Disqus click-to-load
# Copy-paste the static filters below into your "My filters" pane in the
# dashboard.
# Purpose is to load Disqus comments on demand only, so that no connection
# to `disqus.com` occurs by default when you land on a site which uses
# Disqus comments widget.
# Not connecting to Disqus by default is a good thing for such a
# ubiquitous server as `disqus.com`, which can be used to build a
@bishboria
bishboria / springer-free-maths-books.md
Last active April 25, 2024 06:27
Springer made a bunch of books available for free, these were the direct links
@max-mapper
max-mapper / readme.md
Last active October 30, 2015 03:05
node.js release questions

As a maintainer of native node add-on modules I have some questions about when and why NODE_MODULE_VERSION changes:

(@rvagg has anwered these in the comments below)

@bellbind
bellbind / binding.gyp
Last active January 10, 2022 17:47
[nodejs]Native module with libuv and v8::Promise on node-4
# -*- mode: python -*-
{
"targets": [
{
"include_dirs": ["<!(node -e \"require('nan')\")"],
"target_name": "TimerAndPromise",
"sources": [
"timer-and-promise.cc"
],
"conditions": [
@bellbind
bellbind / binding.gyp
Last active March 22, 2021 16:16
[nodejs]Making native package for node.js-4.x with nan-2.0
# -*- mode: python -*-
{
"targets": [
{
"include_dirs": ["<!(node -e \"require('nan')\")"],
"target_name": "NanExample",
"sources": [
"nan-example.cc"
],
"conditions": [
@theshadowx
theshadowx / QtNaCl.sh
Last active September 24, 2021 17:35
Qt/Qml With Chrome Native Client (NaCl)
#!/bin/bash
set -e
# Install NaCl
wget http://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip
unzip nacl_sdk.zip
rm nacl_sdk.zip
nacl_sdk/naclsdk list
@voldyman
voldyman / AppList.vala
Created February 15, 2015 05:23
This program can be used to list all the desktop files that are detected when using a specific menu file.
/* Author: Akshay Shekher
*
* build: valac --pkg gio-unix-2.0 --pkg libgnome-menu-3.0 -X -DGMENU_I_KNOW_THIS_IS_UNSTABLE applist.vala
* run: ./applist gnome-applications.menu
* or ./applist pantheon-applications.menu
*/
int main(string[] args) {
if (args.length < 2) {
print ("Please specify the file to load\n");
@davidcunha
davidcunha / data-structures-summary.md
Last active May 13, 2022 04:36
Data Structures Summary

General purposes data structures

Linked Lists

  • small amount of data, not predictable
  • used when data is frequently inserted and deleted
  • searching is slow
  • the insertion order matters when searching

Arrays

  • searching and deletion are slow