Skip to content

Instantly share code, notes, and snippets.

View d30jeff's full-sized avatar
💭
Eating caviar and hacking famine

Deojeff d30jeff

💭
Eating caviar and hacking famine
View GitHub Profile
@d30jeff
d30jeff / index.php
Created February 10, 2016 17:57
Date now minus 4 months
<?php
foreach (range(1,4) as $index) {
$arr[] = date("m/Y", strtotime("-{$index} months"));
}
echo implode("\n", $arr);
@d30jeff
d30jeff / main.py
Last active February 4, 2016 03:49
With comment
task_num = 1
# total task number dia bagi 1
def questions():
# Function bernama 'questions'
print ("Please select symbol")
# Print keluar text di atas.
symbol = input()
# Prompt input dan lepas tu input value dari user dalam variable 'symbol'
@d30jeff
d30jeff / main.py
Created February 4, 2016 03:36
Cider
task_num = 1
def questions():
print ("Please select symbol")
symbol = input()
print ("'{}' has been selected as the symbol.".format(symbol))
print ("Please specify the height")
height = input()
@d30jeff
d30jeff / index.php
Created November 20, 2015 07:29
Reverse Thingy
<?php
$string = "Ram Is Good Boy";
$reversed = implode(" ", array_map('ucfirst', ( array_reverse( explode(" ", strrev(strtolower($string))))) ));
echo $reversed;
@d30jeff
d30jeff / AuthenticateController.php
Created November 17, 2015 15:25
Why Laravel, Whyyy
class AuthenticateController extends Controller
{
public function index()
{
}
public function authenticate(Request $request)
{
@d30jeff
d30jeff / index.php
Created October 29, 2015 16:57
Bullshit
<?php
$string = "A,B,C,D,'1,2,3,4,5,6',F,G";
$boom = explode("'", $string)[1];
$new_string = str_replace($boom, "", $string);
foreach (explode(",", $new_string) as $letter) {
if ($letter != "''") {
@d30jeff
d30jeff / index.html
Created October 22, 2015 15:19
Click to add text field
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script>
$(function() {
$("#clickMe").on('click', function() {
var menu = "<label>Name</label><input type='text' name='name[]'>";
@d30jeff
d30jeff / palindrome.php
Created October 20, 2015 14:47
Check Palindrome
<?php
$input = "was it a car or a cat I saw?";
$input = preg_replace("/[^a-zA-Z0-9]/", "", $input);
$string = strtolower(implode("", str_split(str_replace(' ', '', $input))));
$evenOrOdd = function($string) {
return (strlen($string) % 2 == 0) ? "even" : "odd";
@d30jeff
d30jeff / index.php
Created October 20, 2015 08:26
Winning Solution
<?php $retardadize = function($string, $firstRetard) {$each = str_split(strtolower($string));$ultimateRetardSolution = "";$retardPotion = ($firstRetard) ? true : false;foreach ($each as $x ) {if ($retardPotion) {$ultimateRetardSolution .= strtoupper($x);$retardPotion = (ctype_space($x)) ?: false;} else {$ultimateRetardSolution .= strtolower($x);$retardPotion = (ctype_space($x)) ?: true;}}return $ultimateRetardSolution;};echo $retardadize("Hello World", true);
@d30jeff
d30jeff / retardadize.php
Created October 20, 2015 08:23
Ultimate Retard Solution
<?php
$retardadize = function($string, $firstRetard) {
$each = str_split(strtolower($string));
$ultimateRetardSolution = "";
$retardPotion = ($firstRetard) ? true : false;
foreach ($each as $x ) {
if ($retardPotion) {