Skip to content

Instantly share code, notes, and snippets.

View cupnoodle's full-sized avatar

soulchild cupnoodle

View GitHub Profile
@cupnoodle
cupnoodle / mechanize_set_cookie.rb
Created July 7, 2016 16:20
Manually set cookie when web scraping
@cupnoodle
cupnoodle / dynamicCookieValue.js
Created July 7, 2016 17:01
Setting dynamic cookie value check by UTAR WBLE lulz
var d1 = new Date();
d1.toUTCString();
document.cookie = 'scraperCheck='+ d1 + 'abcdefgh@' + '; Fri, 22 April 2016 20:47:11 UTC; path=/';
@cupnoodle
cupnoodle / post-receive
Last active February 9, 2017 05:19
Post receive with unicorn/nginx, deploy script
#!/bin/bash -l
#The -l parameter executes the command in a login shell
GIT_DIR=/home/rails/repo/fox_sample.git
WORK_TREE=/home/rails/fox_sample
while read oldrev newrev ref
do
@cupnoodle
cupnoodle / add-git-remote.txt
Created September 9, 2016 15:01
Add git remote
git remote add live ssh://username@your_server_ip:port/home/username/repo/app_name.git
@cupnoodle
cupnoodle / scp-applicationyml.txt
Last active September 19, 2016 21:22
copy application.yml using scp from local to remote server
scp -P port_number_here config/application.yml username@remote_server_ip:/home/username/app_name/config/application.yml
@cupnoodle
cupnoodle / preventhotlink.json
Created October 1, 2016 09:47
Prevent hotlink bucket policy
@cupnoodle
cupnoodle / titleAnimateViewController.swift
Created October 20, 2016 09:08
Animate titleLabel in UIButton
//
// ViewController.swift
// Animated Button
//
// Created by Soul on 20/10/2016.
// Copyright © 2016 sweatshops. All rights reserved.
//
import UIKit
@cupnoodle
cupnoodle / sites-available-ghost
Created October 22, 2016 18:48
Ghost nginx config file with HTTPS Remember to put the well-known location in default file
server {
listen 80;
server_name fluffy.es;
#location / {
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header Host $http_host;
# proxy_pass http://127.0.0.1:2368;
#}
#location ~ /.well-known {
@cupnoodle
cupnoodle / UIViewController+Utils.m
Created December 7, 2016 08:26
Get the current active view controller on iOS screen
//
// UIViewController+Utils.m
// Novel
//
// Created by Axel Kee on 07/12/2016.
// Copyright © 2016 Javed. All rights reserved.
//
#import "UIViewController+Utils.h"
@cupnoodle
cupnoodle / tictactoe.rb
Last active April 10, 2017 15:21
Tic Tac Toe Winning Check with O(1) time
@boardsize = 0
@boards_map = Array.new(1) {Array.new(1,"·")}
positionArray = Array.new
# keep track of how many X in a given row
@row_stats = Array.new
# keep track of how many X in a give column
@column_stats = Array.new