Skip to content

Instantly share code, notes, and snippets.

View jookyboi's full-sized avatar

Rui Jiang jookyboi

View GitHub Profile
@jookyboi
jookyboi / select.ts
Last active March 26, 2019 15:20
# Markdown - With bullet - Bullet
private selectSnippetInList(snippet: Snippet) {
this.appEventsService.push({
type: AppEventType.SelectSnippet,
data: { snippet }
});
}
@jookyboi
jookyboi / HelloWord.java
Created February 20, 2019 15:19
Example gist for Cacher
public class HelloWorld {
public static void main(String[] args) {
// Prints "Hello, World" to the terminal window.
System.out.println("Hello, World");
}
}
@jookyboi
jookyboi / foobar.md
Last active February 18, 2019 16:35 — forked from rust-play/playground.rs
Code shared from the Rust Playground

ok

@jookyboi
jookyboi / fix.md
Last active March 22, 2018 18:56
The following is a hack to get around the issue posed by https://github.com/paypal/paypal-checkout/issues/323. It uses Electron to close the BrowserWindow when the popup fails to load. In the latest version of `checkout.js`, Paypal will fall back to

From Electron's main.ts:

import { BrowserWindow, ipcMain } from 'electron';
...
ipcMain.on(
    'close-paypal',
    () => {
        BrowserWindow.getAllWindows().forEach((win) => {
            // The Paypal window would fail to load contents due to security 
 // restrictions and return an empty URL
// PhantomJS Cheatsheet
$ brew update && brew install phantomjs // install PhantomJS with brew
phantom.exit();
var page = require('webpage').create();
page.open('http://example.com', function() {});
page.evaluate(function() { return document.title; });
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@jookyboi
jookyboi / time_advance.rb
Created November 22, 2013 15:56
Manipulating Time in Rails
Time.now.advance(:days => 1, :hours => -1)
@jookyboi
jookyboi / random_boolean.rb
Created November 19, 2013 21:19
Randomly pick boolean value
[true, false].sample
jQuery(
function($)
{
$('#flux').bind('scroll', function()
{
if($(this).scrollTop() +
$(this).innerHeight()
>= $(this)[0].scrollHeight)
{
alert('end reached');
@jookyboi
jookyboi / install_notes.txt
Created October 29, 2013 23:11
Postgres install notes
initdb /usr/local/var/postgres -E utf8 # create a database cluster
postgres -D /usr/local/var/postgres # serve that database
PGDATA=/usr/local/var/postgres postgres # …alternatively
If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
https://github.com/mxcl/homebrew/issues/issue/2510
To migrate existing data from a previous major version (pre-9.3) of PostgreSQL, see:
http://www.postgresql.org/docs/9.3/static/upgrading.html