Skip to content

Instantly share code, notes, and snippets.

View vinamelody's full-sized avatar

Vina Melody vinamelody

View GitHub Profile
@vinamelody
vinamelody / 0_reuse_code.js
Created July 26, 2014 03:56
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
function my_woocommerce_loaded_function() {
global $woocommerce;
// remove WC generator tag from <head>
remove_action( 'wp_head', array( $woocommerce, 'generator' ) );
}
// called only after woocommerce has finished loading
add_action( 'woocommerce_init', 'my_woocommerce_loaded_function' );
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vinamelody
vinamelody / firebase-query.swift
Created July 7, 2016 07:29
Swift: Query one last entry from Firebase, with completion handler
func getTheLastGuestKey(completionHandler: (Bool)-> ()) {
self.guestRef.queryOrderedByKey().queryLimitedToLast(1).observeSingleEventOfType(.Value, withBlock: {(snapshot) in
for guest in snapshot.children {
let guestSnapshot = snapshot.childSnapshotForPath(guest.key)
var lastGuestCheckintime: String! = ""
if let result_checkin = guestSnapshot.value?["checkintime"] as? NSNumber {
lastGuestCheckintime = "\(result_checkin)"
}
@vinamelody
vinamelody / takephoto.swift
Created July 7, 2016 08:07
Swift: Take photo button action
@IBAction func takePhoto(sender: UIButton) {
let imagePicker: UIImagePickerController! = UIImagePickerController()
imagePicker.delegate = self
if (UIImagePickerController.isSourceTypeAvailable(.Camera)) {
if UIImagePickerController.availableCaptureModesForCameraDevice(.Front) != nil {
imagePicker.allowsEditing = false
imagePicker.sourceType = .Camera
imagePicker.cameraCaptureMode = .Photo
@vinamelody
vinamelody / .gitconfig
Created November 17, 2016 03:12
Git config
[alias]
d = diff
br = branch --all
ci = commit
co = checkout
dh = diff HEAD
lg = log --graph --pretty=format:'%Cred%h..%Creset - %s %Cgreen(%cr)%Creset - %an' --abbrev-commit --date=relative
lgn = log --pretty=oneline --abbrev-commit --show-notes=*
mnff = merge --no-ff
rh = reset --soft HEAD^
@vinamelody
vinamelody / Github2.css
Created December 13, 2016 01:56
Macdown Github2 for Rendering (folder Style)
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {