Skip to content

Instantly share code, notes, and snippets.

View Iamscalla's full-sized avatar

Iamscalla

  • EveryWhere
View GitHub Profile
@himmelmaus
himmelmaus / thanos_sort.py
Created March 25, 2019 01:20
A quick implementation of the thanos sort algorithm, removing half of the array's elements at a time until the array is sorted
from random import randint
def thanos_sort(array):
while not is_sorted(array):
target_length = int(len(array)/2)
while len(array) > target_length:
del array[randint(0, len(array)-1)]
return array
def is_sorted(array):
@taitems
taitems / plate-snitch.js
Created August 20, 2017 03:56
(Extract) Check the status of a vehicle registration and scrape results.
// Open form and submit enquire for `rego`
function getInfo(rego) {
horseman
.userAgent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0')
.open(url)
.type('#registration-number-ctrl input[type=text]', rego)
.click('.btn-holder input')
.waitForSelector('.ctrl-holder.ctrl-readonly')
.html()
.then(function(body) {
@technoknol
technoknol / Laravel eloquent where-group-and-whereor-sorting-orderby-search.php
Created May 23, 2017 09:26
Full pagination, searching, orderby and sorting in laravel eloquent model
<?php
// You may need to use this classes
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use Illuminate\Pagination\Paginator;
// Searching in segments Model, with pagination, ordering, sorting and searching.
$segments = Segment::where('segmentProviderName', $provider); // first where condition
$segmentStatuses = config('constants.segment.status');
@alexanderbartels
alexanderbartels / foundation.offcanvas.html
Last active March 11, 2023 11:00
CSS to show the offcanvas menu only on mobile and tablet. On Large Screens is the menu always visible
<div class="off-canvas-wrap" data-offcanvas>
<div class="inner-wrap">
<nav class="tab-bar">
<section class="left-small">
<a class="left-off-canvas-toggle menu-icon" href="#"><span></span></a>
</section>
<section class="middle tab-bar-section">
<h1 class="title">Offcanvas example</h1>
</section>
@TylerFisher
TylerFisher / hosting-on-github.md
Last active May 1, 2025 17:15
Basic steps for hosting on Github

Hey there, apparently people are still using this Gist from 2013! It's out of date! Consult the Github docs.

Steps for Hosting a Website on GitHub

  1. Create a GitHub account on github.com.
  2. Download either [GitHub for Mac][1] or [GitHub for Windows][2], depending on your operating system. Open the app and log in using the account you just created.
  3. (On Mac): After you login, click advanced and make sure that your name and email are correct. Then, click "Install Command Line Tools", just in case you want to start using the command line later in life.
  4. Create a new repository in your GitHub application. Name it your-username.github.io. The name is very important. Note the folder that GitHub is saving the repository to. Make sure the "Push to GitHub?" box is checked.
  5. Move your website's files into the folder that GitHub just created when you made the repository. IMPORTANT: Your homepage HTML file must be called "index.html", and it must exist in the top-level
@havvg
havvg / ajax-form.js
Created August 1, 2012 13:20
jQuery AJAX form submit with Twitter Bootstrap modal
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
@bih
bih / Cheddar-loader.html
Created July 28, 2012 19:00
A simple gist of a Cheddar-logo HTML/CSS/JS logo loader effect. Boredom was a big part of this gist fruition. It is a bit 'hacky' like, so I wouldn't recommend it in production.
<!doctype html>
<head>
<title>Cheddar Loader</title>
<!-- Produced by @bilawalhameed -->
<!-- tha css. kthxbai. -->
<style type="text/css">
#cheddar-loading {
position: relative;
width: 539px;
@klodio
klodio / For benchmark purposes
Created January 11, 2012 11:50 — forked from bussyjd/For benchmark purposes
PHP random image generator
<?php
error_reporting(E_ALL);
$limit=10;
$width = 120;
$height = 20;
for($x=0;$x<$limit;$x++) {
$im = @imagecreatetruecolor(1200, 200);
$text_color = imagecolorallocate($im, 233, 14, 91);