Skip to content

Instantly share code, notes, and snippets.

View projektorius96's full-sized avatar
🐢
Turtles do code

LG projektorius96

🐢
Turtles do code
View GitHub Profile
@benzittlau
benzittlau / Remove From Git By Extension
Created May 4, 2011 21:59
Remove all *.swp files from a git repository
git ls-files | grep '\.swp$' | xargs git rm
@llkats
llkats / cheatsheet.md
Last active November 26, 2023 06:38
git cheatsheet

git flow feature start <branchname>
starts a new branch

git commit -am "commit message"
make commits as usual

git pull
from master branch, pull in latest changes from the repo (repeat often)

git pull origin <branchname>

@jbgo
jbgo / git-recover-branch.md
Last active May 23, 2024 12:29
How to recover a git branch you accidentally deleted

UPDATE: A better way! (August 2015)

As pointed out by @johntyree in the comments, using git reflog is easier and more reliable. Thanks for the suggestion!

 $ git reflog
1ed7510 HEAD@{1}: checkout: moving from develop to 1ed7510
3970d09 HEAD@{2}: checkout: moving from b-fix-build to develop
1ed7510 HEAD@{3}: commit: got everything working the way I want
70b3696 HEAD@{4}: commit: upgrade rails, do some refactoring
@rcknr
rcknr / DriveUpload.gs
Last active February 15, 2023 20:06
This is a sample code to upload a PDF file to Google Drive with OCR in Apps Script. uploadPdfOcr function returns a File object. To run the code provide a developer key for an API Console project with Drive API service enabled.
function uploadPdfOcr() {
authorize();
var key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // <-- developer key
var file = UrlFetchApp.fetch("http://somewhere.com/path/file.pdf").getBlob();
var metadata = { title: file.getName() }
var params = {method:"post",
oAuthServiceName: "drive",
oAuthUseToken: "always",
contentType: "application/pdf",
contentLength: file.getBytes().length,
@kenshinx
kenshinx / client.go
Last active February 3, 2024 18:49
golang socket server & client ping-pong demo
package main
import (
"os"
"log"
"net"
"strconv"
"strings"
)
@leommoore
leommoore / Express_Logging.md
Last active August 20, 2021 19:27
Express - Logging

#Express - Logging The express.js node.js web application framework comes with a built-in logging module called logger which is the connect.js logger. It is really handy to enable and you can use it just like any other Express module. app.use(express.logger());

Without any configuration, the logger middleware will generate a detailed log using what is called the default format. The logger actually supports four predefined log formats: default, short ,tiny, and dev. Each of these predefined formats show various amounts of detail. You can specify one of them this way:

app.use(express.logger('dev'));

If you prefer, you can customize the precise details to be logged using the the following options to format the output of the logger:

@intruxxer
intruxxer / ajax-post.js
Last active June 2, 2019 18:26
Format of AJAX with POST type using jQuery
$.post(url, { comment: text }, function(data) {
alert(data);
});
//or
$.ajax(url, { data: { title: text1, comment: text2 },
type: "POST",
beforeSend: function() {
alert("before send");
@indexzero
indexzero / ISC.md
Created April 13, 2014 21:00
ISC vs. MIT

Copyright (c) 4-digit year, Company or Person's Name

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Source: http://opensource.org/licenses/ISC

@miguelmota
miguelmota / buffer.js
Created August 24, 2014 18:33
Node.js Buffer to ArrayBuffer
// @credit: http://stackoverflow.com/questions/8609289/convert-a-binary-nodejs-buffer-to-javascript-arraybuffer
// From Buffer to ArrayBuffer:
function toArrayBuffer(buffer) {
var ab = new ArrayBuffer(buffer.length);
var view = new Uint8Array(ab);
for (var i = 0; i < buffer.length; ++i) {
view[i] = buffer[i];
}