Skip to content

Instantly share code, notes, and snippets.

Awesome PHP

A curated list of amazingly awesome PHP libraries, resources and shiny things.

Composer

Composer Related

request = require 'request'
async = require 'async'
url = "http://letsrevolutionizetesting.com/challenge.json"
id = null
message = null
async.whilst ->
not message?
, (callback) ->
oUurl = url
@schaitanya
schaitanya / asyc.coffee
Created September 13, 2013 16:24
Async whilst
@loop: (method, data, callback) ->
results = []
data.pageNumber ?= 1
@[method] data, (err, res) =>
# totalResults = res?.totalNumberOfElements
# numberOfElements = res?.numberOfElements
totalPages = parseInt(res[0]?.result?.totalPages)
results.push res[0]?.result?.resultSet
async.whilst ->
return data.pageNumber isnt totalPages
{
"query": {
"custom_filters_score": {
"query": {
"filtered": {
"query": {
"bool": {
"must": [
{
"field": {
@schaitanya
schaitanya / package.json
Last active December 17, 2015 15:10
Create backup, and re-index elastic search data with scan and scroll
{
"name": "re-index",
"version": "0.0.1",
"description": "Create backup, and re-index elastic search data with scan and scroll",
"main": "re-index.coffee",
"author": "Chaitanya Surapaneni",
"license": "MIT",
"dependencies": {
"request": "~2.21.0",
"async": "~0.2.8",
#!/bin/sh
host=localhost:9200
curl -X DELETE "${host}/test"
curl -X PUT "${host}/test" -d '{
"settings" : { "index" : { "number_of_shards" : 1, "number_of_replicas" : 0 }}
}'

OSX (built in)

list the directories in the current directory
ls -d */
get or set kernel state
sysctl
TCP window scale option
sysctl net.inet.tcp.rfc1323
shows date in historyfile
export HISTTIMEFORMAT="%h/%d - %H:%M:%S "
show wan-ip

@schaitanya
schaitanya / cheat_sheet.org.sh
Last active July 11, 2016 22:02
Linux Cheat Sheet
# From https://github.com/WilliamHackmore/linuxgems
# cheat_sheet.org
# (C) William Hackmore, 2010
# The contents of this file are released under the GNU General Public License. Feel free to reuse the contents of this work, as long as the resultant works give proper attribution and are made publicly available under the GNU General Public License.
# Last updated 8/14/2012
# Best viewed in emacs org-mode.
* Command Reference:
** Basics:
*** Getting help: