Skip to content

Instantly share code, notes, and snippets.

View devarda's full-sized avatar
💻

Arda devarda

💻
View GitHub Profile
@devarda
devarda / jquery.addrule.js
Created February 16, 2020 17:25 — forked from yckart/jquery.addrule.js
Add css-rules to an existing stylesheet - http://stackoverflow.com/a/16507264/1250044
/*!
* jquery.addrule.js 0.0.2 - https://gist.github.com/yckart/5563717/
* Add css-rules to an existing stylesheet.
*
* @see http://stackoverflow.com/a/16507264/1250044
*
* Copyright (c) 2013 Yannick Albert (http://yckart.com)
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php).
* 2013/11/23
**/
@devarda
devarda / get minimum of object value in array.js
Created December 27, 2019 14:00
Neat one liner to get the minimum of [ {x:1}, {x:2}, {x:3} ]. Minimum of Array of Objects, specific key.
let arr = [ {x:1}, {x:2}, {x:3} ];
let min = Math.min.apply(Math, arr.map(o => o.x));
console.log('Minimum is", min);
@devarda
devarda / README.md
Last active August 11, 2019 00:11
Building PHP from source on Mac :: PHP 7.3.8 Compilation on macOS Mojave 10.14.5
@devarda
devarda / Vagrantfile
Created June 26, 2019 18:40 — forked from mrfolkblues/Vagrantfile
Vagrant / Ubuntu 14.04.5 + PHP 7.1 + MariaDB 10.1 + Apache 2.4.7
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Update your Vagrant install before using.
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "192.168.71.71"
@jeromecoupe
jeromecoupe / webstoemp-gulpfile.js
Last active January 21, 2024 16:28
Gulp 4 sample gulpfile.js. For a full explanation, have a look at https://www.webstoemp.com/blog/switching-to-gulp4/
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");
@prplmark
prplmark / gulpfile.js
Last active August 16, 2021 22:40
Gulpfile with Webpack and SCSS watch
// Essentials
var gulp = require('gulp');
var webpack = require('webpack'); // Include webpack to add definePlugin
var webpackStream = require('webpack-stream'); // Use webpack-stream to compile
// Sass Requires
var sass = require('gulp-sass'); // Include SASS
var autoprefix = require('gulp-autoprefixer'); // Autoprefixer (always)
var rename = require('gulp-rename'); // Gulp Rename
var sourcemaps = require('gulp-sourcemaps'); // Sourcemaps (for sass)
@EtienneR
EtienneR / user.js
Created January 7, 2016 23:39
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);
@ygotthilf
ygotthilf / jwtRS256.sh
Last active June 27, 2024 16:13
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@norcal82
norcal82 / city_names.js
Last active November 7, 2023 23:55
javascript array of major us city names
// javascript, coffeescript, jquery...
var city_names = ["Aberdeen", "Abilene", "Akron", "Albany", "Albuquerque", "Alexandria", "Allentown", "Amarillo", "Anaheim", "Anchorage", "Ann Arbor", "Antioch", "Apple Valley", "Appleton", "Arlington", "Arvada", "Asheville", "Athens", "Atlanta", "Atlantic City", "Augusta", "Aurora", "Austin", "Bakersfield", "Baltimore", "Barnstable", "Baton Rouge", "Beaumont", "Bel Air", "Bellevue", "Berkeley", "Bethlehem", "Billings", "Birmingham", "Bloomington", "Boise", "Boise City", "Bonita Springs", "Boston", "Boulder", "Bradenton", "Bremerton", "Bridgeport", "Brighton", "Brownsville", "Bryan", "Buffalo", "Burbank", "Burlington", "Cambridge", "Canton", "Cape Coral", "Carrollton", "Cary", "Cathedral City", "Cedar Rapids", "Champaign", "Chandler", "Charleston", "Charlotte", "Chattanooga", "Chesapeake", "Chicago", "Chula Vista", "Cincinnati", "Clarke County", "Clarksville", "Clearwater", "Cleveland", "College Station", "Colorado Springs", "Columbia", "Columbus", "Concord", "Coral Spri
@kelvinn
kelvinn / cmd.sh
Created July 24, 2014 02:55
Example of using Apache Bench (ab) to POST JSON to an API
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/