Skip to content

Instantly share code, notes, and snippets.

Avatar

Rui Jiang jookyboi

View GitHub Profile
@jookyboi
jookyboi / select.ts
Last active Mar 26, 2019
# Markdown - With bullet - Bullet
View select.ts
private selectSnippetInList(snippet: Snippet) {
this.appEventsService.push({
type: AppEventType.SelectSnippet,
data: { snippet }
});
}
@jookyboi
jookyboi / HelloWord.java
Created Feb 20, 2019
Example gist for Cacher
View HelloWord.java
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 Feb 18, 2019 — forked from rust-play/playground.rs
Code shared from the Rust Playground
@jookyboi
jookyboi / fix.md
Last active Mar 22, 2018
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
View fix.md

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
View casperjs.cheatsheet.js
// 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; });
View wp-query-ref.php
<?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 Nov 22, 2013
Manipulating Time in Rails
View time_advance.rb
Time.now.advance(:days => 1, :hours => -1)
@jookyboi
jookyboi / random_boolean.rb
Created Nov 19, 2013
Randomly pick boolean value
View random_boolean.rb
[true, false].sample
View scroll_bottom.js
jQuery(
function($)
{
$('#flux').bind('scroll', function()
{
if($(this).scrollTop() +
$(this).innerHeight()
>= $(this)[0].scrollHeight)
{
alert('end reached');
@jookyboi
jookyboi / install_notes.txt
Created Oct 29, 2013
Postgres install notes
View install_notes.txt
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
You can’t perform that action at this time.