Skip to content

Instantly share code, notes, and snippets.

@assoft
assoft / troubleshooting.md
Created February 5, 2017 00:59 — forked from adamwathan/troubleshooting.md
Troubleshooting Valet on macOS Sierra

Troubleshooting Valet on Sierra

Common Problems

Problem: I just see "It works!"

Apache is running on port 80 and interfering with Valet.

  1. Stop Apache: sudo /usr/sbin/apachectl stop
  2. Restart Valet: valet restart
@assoft
assoft / install_zsh.sh
Created April 16, 2017 03:06
ZSH Vagrant
#!/bin/bash
homestead up
homestead ssh
apt-get update
#Additional Packages
apt-get install -y zsh
@assoft
assoft / getTff
Last active November 26, 2018 13:09
TFF Fikstür (PHP)
public function getTff(){
$ch = curl_init();
$hc = "YahooSeeker-Testing/v3.9 (compatible; Mozilla 4.0; MSIE 5.5; Yahoo! Search - Web Search)";
curl_setopt($ch, CURLOPT_REFERER, 'http://www.google.com');
curl_setopt($ch, CURLOPT_URL, 'http://www.tff.org/default.aspx?pageID=198');
curl_setopt($ch, CURLOPT_USERAGENT, $hc);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$content = iconv("ISO-8859-9", "UTF-8", curl_exec($ch));
curl_close($ch);
@assoft
assoft / 01.md
Created July 23, 2019 18:24 — forked from nasrulhazim/01.md
Laravel Default API Login

Setup

Migration

Create new migration script:

php artisan make:migration add_api_token --table=users
@assoft
assoft / RouteDirectives.php
Created January 4, 2020 13:10 — forked from calebporzio/RouteDirectives.php
Blade Route Directives
<?php
// Register these inside a service provider:
Blade::directive('route', function ($expression) {
return "<?php echo route({$expression}) ?>";
});
Blade::directive('routeIs', function ($expression) {
return "<?php if (request()->routeIs({$expression})) : ?>";
@assoft
assoft / DocumentContentExtractor.php
Created August 10, 2020 04:41 — forked from lubobill1990/DocumentContentExtractor.php
Extract content from docx, doc and rtf
<?php
/**
* Created by IntelliJ IDEA.
* User: bill
* Date: 2018/11/06
* Time: 13:24
*/
use InvalidArgumentException;
@assoft
assoft / selenium-youtube.rb
Created December 28, 2020 02:32 — forked from mqu/selenium-youtube.rb
selenium and youtube player
#!/usr/bin/ruby
require "selenium-webdriver"
require 'pp'
# install :
# sudo apt-get install ruby ruby-dev chromium-chromedriver firefoxdriver
# sudo gem install selenium-webdriver
# sudo ln -s /usr/lib/chromium-browser/chromedriver /usr/local/bin/
@assoft
assoft / title-case.js
Last active March 26, 2021 18:47
Javascript Title Case
/* To Title Case © 2018 David Gouch | https://github.com/gouch/to-title-case */
// eslint-disable-next-line no-extend-native
String.prototype.toTitleCase = function () {
'use strict'
var smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|v.?|vs.?|via)$/i
var alphanumericPattern = /([A-Za-z0-9\u00C0-\u00FF])/
var wordSeparators = /([ :–—-])/
return this.split(wordSeparators)
@assoft
assoft / db:create.php
Created June 13, 2021 20:25
Valet DB Create Extension
<?php
namespace Valet;
use function Valet\info;
use function Valet\warning;
// Put this file in your ~/config/.valet/Extensions directory!
/**
@assoft
assoft / vimeo-downloader.js
Created July 8, 2021 18:12 — forked from aik099/vimeo-downloader.js
Download video from Vimeo (chopped m4s files)
// 1. Open the browser developper console on the network tab
// 2. Start the video
// 3. In the dev tab, locate the load of the "master.json" file, copy its full URL
// 4. Run: node vimeo-downloader.js "<URL>"
// (done automatically now) 5. Combine the m4v and m4a files with mkvmerge
const fs = require('fs');
const url = require('url');
const https = require('https');
const { exec } = require('child_process');