Skip to content

Instantly share code, notes, and snippets.

View alireza-ahmadi's full-sized avatar

Alireza Ahmadi alireza-ahmadi

View GitHub Profile
@ratik
ratik / disableAllMethods.js
Last active October 12, 2018 09:52
LoopbackJs disable all remote methods and enable only selected
/**
* Based on @ericprieto code https://github.com/strongloop/loopback/issues/651#issuecomment-140879983
* place this file into common/mixins/disableAllMethods.js
*
**/
module.exports = function(Model, options) {
if(Model && Model.sharedClass) {
var methodsToExpose = options.expose || [];
@lyndell
lyndell / by.sh
Last active July 10, 2016 02:49
Open a new file in ByWord
#/bin/bash -x
#
# Copyright (c) 2015 Lyndell Rottmann
#
# Debug mode on/off: (default off)
set +x
if [[ "$OSTYPE" == "darwin"* ]]; then
if [ ! $1 ]
@paulirish
paulirish / what-forces-layout.md
Last active April 30, 2024 17:56
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@TheSeamau5
TheSeamau5 / multipageform.elm
Last active October 30, 2020 16:54
Simple multi-page form
import Html exposing (Html, Attribute)
import Html.Attributes
import Html.Events
import Signal exposing (Address)
import List
import String
import StartApp
------------------
--- HELPER CODE --
@reshadman
reshadman / Loop.java
Created May 3, 2015 17:15
Simple loop in programming languages -- for permance benchmarking of a WHILE LOOP --
public class Loop {
public static void main(String[] args)
{
Integer total = 500000000;
Integer chunk = 50000000;
Integer i = 0;
@denji
denji / golang-tls.md
Last active April 29, 2024 03:39 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@addyosmani
addyosmani / LICENSE.txt
Last active April 8, 2024 20:15 — forked from 140bytes/LICENSE.txt
Offline Text Editor in < 140 bytes (115 bytes). Powered by localStorage & contentEditable
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Copyright (C) 2014 ADDY OSMANI <addyosmani.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@ismasan
ismasan / sse.go
Last active March 19, 2024 18:13
Example SSE server in Golang
// Copyright (c) 2017 Ismael Celis
// 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
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
@archon810
archon810 / BuildConfig.java
Last active September 28, 2022 15:17
Fake Virus Shield AV
package com.deviant.security.shield;
public final class BuildConfig {
public static final String BUILD_TYPE = "debug";
public static final boolean DEBUG;
public static final String FLAVOR = "";
public static final String PACKAGE_NAME = "com.deviant.security.shield";
public static final int VERSION_CODE = 4;
public static final String VERSION_NAME = "2.2";