Skip to content

Instantly share code, notes, and snippets.

🦄
Focusing

Gary Lai imgarylai

🦄
Focusing
Block or report user

Report or block imgarylai

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@imgarylai
imgarylai / clion.md
Created Nov 10, 2017
Clion - Change default compiler
View clion.md
View secret-keygen.py
"""
Pseudo-random django secret key generator.
- Does print SECRET key to terminal which can be seen as unsafe.
"""
from __future__ import print_function
import string
import random
# Get ascii Characters numbers and punctuation (minus quote characters as they could terminate string).
chars = ''.join([string.ascii_letters, string.digits, string.punctuation])\
@imgarylai
imgarylai / DoublyLinkedList.c
Created Aug 29, 2017 — forked from mycodeschool/DoublyLinkedList.c
Doubly Linked List implementation in C
View DoublyLinkedList.c
/* Doubly Linked List implementation */
#include<stdio.h>
#include<stdlib.h>
struct Node {
int data;
struct Node* next;
struct Node* prev;
};
@imgarylai
imgarylai / _INSTRUCTIONS.md
Last active Aug 4, 2017 — forked from jiaaro/_INSTRUCTIONS.md
Using Swift libraries in Python
View _INSTRUCTIONS.md

Using Swift libraries in Python

So... this is obviously totally, 100%, like for. real. not. supported. by. Apple. …yet?

But still... I thought it was pretty badass. And, seeing how there's already a Swift buildpack for Heroku you could move some slow code into Swift can call it as a library function. But, you know, not in production or anything. That would be silly, right?

Now, having said that, the actual Python/Swift interop may have bugs. I'll leave that as an exercise to the reader.

How to get Python code calling Swift functions:

@imgarylai
imgarylai / read-access.sql
Created Jul 24, 2017 — forked from oinopion/read-access.sql
How to create read only user in PostgreSQL
View read-access.sql
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
@imgarylai
imgarylai / KeyboardViewController.swift
Created May 16, 2017 — forked from critical186/KeyboardViewController.swift
KeyboardViewController.swift source from AppDesignVault for Swift 3
View KeyboardViewController.swift
//
// KeyboardViewController.swift
// Demo Custom Keyboard
//
// Created by Drew Lustro on 10/20/14.
// Updated by Jared Bigcraft on 10/29/2016 to work with Swift 3
//
// Original derived from tutorial found on AppDesignVault
// http://www.appdesignvault.com/ios-8-custom-keyboard-extension/
//
View instagram.js.jsx
var InstagramItem = React.createClass({
render: function() {
return (
<div className="col-sm-3 col-xs-6">
<a href={this.props.image.link} target="_blank">
<div className="image-overlay text-center">
<img src={this.props.image.images.low_resolution.url} className="img-responsive"/>
<div className="caption">
<i className="fa fa-heart">
{this.props.image.likes.count}</i>
@imgarylai
imgarylai / Front-end-Developer-Interview-Questions-TC.md
Created Nov 18, 2015 — forked from hanksudo/Front-end-Developer-Interview-Questions-TC.md
Front-end-Developer-Interview-Questions - 前端工程師面試問題集(繁體中文版)
View Front-end-Developer-Interview-Questions-TC.md

前端工程師面試問題集

@版本 2.0.0

譯注:此翻譯版,主要給不能流利的讀英文的人看,相關專有名詞還是保留原文。翻譯不好地方請協助pull request.

此repository包含了一些前端開發的面試問題,來審查一個有潛力的面試者。這並不是建議你對同一個面試者問上所有的問 (那會花費好幾小時)。從列表中挑幾個題目,應該就夠幫助你審查面試者是否擁有你需要的技能。

Rebecca MurpheyBaseline For Front-End Developers 也是一篇很棒且值得讀的文章在你開始面試之前。

@imgarylai
imgarylai / fruit-warehouse-installation.md
Last active Aug 29, 2015
fruit-warehouse-installation
View fruit-warehouse-installation.md

a. Ruby on Rails

In your Gemfile include:

gem 'fruit_warehouse'

And then execute:

View deploy.rb
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
# Usually mina focuses on deploying to one host and the deploy options are therefore simple.
# In our case, there is a number of possible servers to deploy to, it is therefore necessary to
# specify the host that we are targeting.
server = ENV['server']
# Since the same host can have multiple applications running in parallel, it is necessary to
You can’t perform that action at this time.