Skip to content

Instantly share code, notes, and snippets.

@tuandm
tuandm / README-Template.md
Created March 18, 2019 17:55 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@tuandm
tuandm / ssb-interop.js
Created October 2, 2018 09:28
Slack ssb-interop.js
/*
* FILE: /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js
*/
/**
* The preload script needs to stay in regular ole JavaScript, because it is
* the point of entry for electron-compile.
*/
const allowedChildWindowEventMethod = [
@tuandm
tuandm / README.md
Created October 1, 2018 00:59 — forked from lacostenycoder/README.md
Ruby script to toggle night-mode hack on Slack Desktop app - Mac only, maybe linux

- IMPORTANT

For security, since this script injects CSS via AJAX, first fork the main slack night mode repo. The reason is explained here

Installation

  • save this script wherever you keep your ruby scripts for example ~/lacostenycoder/scripts/ruby/
  • change the URL in the ruby script to use YOUR repo. The rawgit.com file is created when you fork the repo.
  • For non-MacOS, find where the slack files are and replace line 17 to point to correct path, thanks simbalinux so you would change line 17 for ubuntu like this
  • @file_target = '/usr/lib/slack/resources/app.asar.unpacked/src/static/ssb-interop.js'
class System
{
const MAX_LENGTH = 8;
const MAX_STEP_TO = 2;
static public $a = [];
static public $start = [];
static public $dest = [];
static public $maxX = 0;
static public $maxY = 0;
static public $result = 0;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,48,49,50,51,52,53,54,55,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,79,82,84,87,88,90,92,93,94,95,96,98,99,100,101,102,103,104,105,106,107,108,109,110,112,114,115,116,117,119,120,121,125,127,128,129,130,132,133,134,135,137,140,141,142,143,144,145,146,147,148,149,150,151,152,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,227,228,229,230,231,232,233,234,235,236,237,238,239,241,243,244,245,246,248,249,250,251,252,255,256,257,258,259,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,278,279,280,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,324,325,326,327,328,329,330,331,333,334,337,341,342,343,344,345,346,347,
@tuandm
tuandm / Array Utils
Created April 12, 2016 06:58
Array Utils
class JT_Util_Array
{
/**
* Safety getting array's element. Return default value in case $key is not existed
*
* @param array $array
* @param string $key
* @param mixed $default
* @return mixed
*/
@tuandm
tuandm / gist:5c5b8a74be65476cc4df
Last active March 17, 2016 03:58
Casting vs intval()
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
function a()
{
$a = array();
$test = @intval($a['test']);