Skip to content

Instantly share code, notes, and snippets.

View noru's full-sized avatar
🎮
Working from home

xiuxiuxiu noru

🎮
Working from home
View GitHub Profile
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active April 29, 2024 09:32
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@btroncone
btroncone / rxjs_operators_by_example.md
Last active July 16, 2023 14:57
RxJS 5 Operators By Example
@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
@chrissimpkins
chrissimpkins / gist:5bf5686bae86b8129bee
Last active March 6, 2023 00:10
Atom Editor Cheat Sheet: macOS

Use these rapid keyboard shortcuts to control the GitHub Atom text editor on macOS.

Key to the Keys

  • ⌘ : Command key
  • ⌃ : Control key
  • ⌫ : Delete key
  • ← : Left arrow key
  • → : Right arrow key
  • ↑ : Up arrow key
var revealJS = function(s) {
var hexAlphabet = Array.apply(null, {
length: 10
}).map(Number.call, Number).concat('abcdef'.split(''));
var codes = [8289, 8204, 8205, 8206, 8207, 8234, 8235, 8236, 8237, 8238, 8298, 8299, 8300, 8301, 8302, 8303];
return s.match(/(.{4})/g).map(function(b) {
return b.split('').map(function(i) {
return hexAlphabet[codes.indexOf(i.charCodeAt())]
})
@cngdean
cngdean / gist:3702b7be4b6d298dd69c
Last active July 16, 2018 13:17
scala hackerrank i/o stdin stdout
object hackerrank {
object Solution {
def main(args: Array[String]) {
def fact(n: Int): Int = if (n == 1) 1 else n * fact(n - 1)
for (n <- io.Source.stdin.getLines) {
print(fact(Integer.parseInt(n.toString)) + "\n")
}
}
}
@willprice
willprice / .travis.yml
Last active August 15, 2023 17:12
How to set up TravisCI for projects that push back to github
# Ruby is our language as asciidoctor is a ruby gem.
lang: ruby
before_install:
- sudo apt-get install pandoc
- gem install asciidoctor
script:
- make
after_success:
- .travis/push.sh
env:
@mderazon
mderazon / ClearableAutoCompleteTextView.java
Last active November 30, 2018 16:42
a sub class of AutoCompleteTextView that has a dismiss button with OnClearListener when the clear button is clicked
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.AutoCompleteTextView;
/**
* sub class of {@link android.widget.AutoCompleteTextView} that includes a clear (dismiss / close) button with
* a OnClearListener to handle the event of clicking the button
@mahata
mahata / random.scala
Last active June 5, 2021 20:38
random ascii string generator in Scala
object randomSample {
def randomString(length: Int) = Stream.continually(util.Random.nextPrintableChar) take length mkString
}
println(randomSample.randomString(64))
@kikoanis
kikoanis / MvcMockHelpers.cs
Created October 25, 2012 22:11 — forked from rally25rs/MvcMockHelpers.cs
MvcMockHelpers.cs - Helper Utility for Mocking MVC3 Controllers with Moq.
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Moq;
/// <summary>
/// This helper class can be used to set up Moq mocks of MVC3/4 controllers.