Skip to content

Instantly share code, notes, and snippets.

View zrkb's full-sized avatar
❄️

Zero zrkb

❄️
View GitHub Profile
@zrkb
zrkb / seed.php
Created June 12, 2018 16:04
Larave Seed from json file
// Truncate Table
DB::table('table')->delete();
// Extract Data
$json = File::get('data.json');
// Parse Json
$data = json_decode($json, true); // true for assoc array
// Mass insert
@zrkb
zrkb / dynamic.conf
Created May 28, 2018 03:29
Dynamic subdomains based on folder structure
#
# Host: example.com
#
<VirtualHost *:80>
ServerAdmin dev@example.com
ServerName example.com
ServerAlias example.com
DocumentRoot /var/www/html/deploy/example.com/home
@zrkb
zrkb / web.php
Last active February 2, 2018 14:16
B/F Laravel App - 1
<?php
/*
|----------------------------------------------
| Frontend - (Public)
|----------------------------------------------
*/
Route::group([
'namespace' => 'Frontend',
], function(){
@zrkb
zrkb / dev.conf
Created October 16, 2017 17:46
Apache Virtualhost
<VirtualHost *:80>
ServerAdmin dev@[agency.com]
ServerName subdomain.dev.[agency.com]
DocumentRoot /var/www/html/develop/[project]
ErrorLog /var/log/httpd/[project].dev.[agency.com].error_log
CustomLog /var/log/httpd/[project].dev.[agency.com].access_log combined
</VirtualHost>
@zrkb
zrkb / Prefix.pch
Created September 22, 2016 13:38
Suppress NSLog in Production
#ifndef DEBUG
#define NSLog(...) /* suppress NSLog when in release mode */
#endif
@zrkb
zrkb / APIError.swift
Created August 23, 2016 18:33
API Error - Enum
public enum OauthError: ErrorType {
case AuthorizationUrlGeneration(NSError)
case StateInconsistence
case InvalidRedirectUrl
case MissingParameter
case StateMismatch
case APIError(NSError)
case InvalidResponse
case TokenNotFound
case Unknown
@zrkb
zrkb / swift-warning.sh
Last active September 12, 2016 12:48
Create helpful warnings for the compiler in Xcode 7.3
# This creates a warning for every TODO/FIXME/WARNING comment in all your files
TAGS="TODO:|FIXME:|WARNING:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/"
@zrkb
zrkb / simplepush.php
Created February 9, 2016 14:57
Simple Apple Push Notification - APNs
<?php
// Put your device token here (without spaces):
$deviceToken = '67adf9c7a00b2e2cb8a79911f1656ead158bdebd26618cbb4585b7';
// Put your private key's passphrase here:
$passphrase = 'terere';
// Put your alert message here:
$message = 'My first push notification!';
@zrkb
zrkb / podclean.sh
Created December 22, 2015 20:36
Clear CocoaPods cache, Pods and Podfile.lock, then re-install all your pods.
#!/usr/bin/env bash
PODS="Pods/"
if [ -d "$PODS" ]; then
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "$PODS" & rm -rf Podfile.lock
pod install
else
echo "No existe el directorio $PODS"
- (void)viewDidLoad {
[super viewDidLoad];
NSString *htmlString = [self htmlFromBodyString:@"<p>Lorem Ipsum Dolor</p>"
textFont:[UIFont fontWithName:@"Arial" size:16.0]
textColor:[UIColor colorWithRed:0.208f green:0.208f blue:0.208f alpha:1.0f]];
[self.newsHTMLContent loadHTMLString:htmlString baseURL:[NSURL URLWithString:@"https://cucume.lo/"]];
}