Skip to content

Instantly share code, notes, and snippets.

View balazsnemeth's full-sized avatar

Balázs Németh balazsnemeth

View GitHub Profile
@jordanell
jordanell / addSearchToTables.js
Created April 9, 2018 15:35
Adding TSVectors and indexes to PostgreSQL tables using Sequelize CLI.
const vectorName = '_search';
const searchObjects = {
authors: ['name', 'biography'],
posts: ['name', 'summary'],
};
module.exports = {
up: (queryInterface) => (
queryInterface.sequelize.transaction((t) =>
@p3x-robot
p3x-robot / hack-remove-decorators.js
Last active February 25, 2019 11:02
⛮ How to disable the remove Angular decorators @ngtools/webpack mess
const fs = require('fs');
const cwd = process.cwd();
const hackPath = `${cwd}/node_modules/@ngtools/webpack/src`
const hackFileName = `${hackPath}/angular_compiler_plugin.js`
const hackFileNameHacked = `${hackFileName}.hacked`
const log = '@ngtool/webpack angular decorators remove'
const hack = () => {
if (!fs.existsSync(hackFileNameHacked)) {
const problemCode = fs.readFileSync(hackFileName).toString('utf-8').split('\n');
@mtauraso
mtauraso / xcodebuild flags.md
Last active November 15, 2023 15:44
Xcodebuild flags in CI

Xcodebuild flag reference for CI:

Required flags:

-project OR -workspace

What xcode project/workspace file we're using. If you specify a project on the command-line and that project has an associated workspace, the project is still aware of its existence within the workspace. As an example, worspace level schemes will be available to xcodebuild even if you specify a project on the command line.

-scheme

Specify the scheme to use for build. Schemes specify multiple build/test targets along with environment args and command line parameters. Schemes must be marked "shared" in the xcode UI in order to be available to xcodebuild. For any particular build/test action there is a default configuration when you use a scheme from the Xcode UI.

@spyesx
spyesx / jquery.hasClassRegEx.js
Last active June 10, 2020 10:39
jQuery.hasClassRegEx() hasClass by using a Regex
(function($)
{
$.fn.hasClassRegEx = function(regex)
{
var classes = $(this).attr('class');
if(!classes || !regex){ return false; }
classes = classes.split(' ');
var len = classes.length;
@Benoss
Benoss / config_local.py
Created March 17, 2014 01:09
Django add Debug Toolbar for non HTML response ex: Json rest response
DEBUG=True
SOUTH_TESTS_MIGRATE = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'geo', # Or path to database file if using sqlite3.
'USER': 'postgres', # Not used with sqlite3.
'PASSWORD': 'postgres', # Not used with sqlite3.
'HOST': '127.0.0.1', # Set to empty string for localhost. Not used with sqlite3.
@sevcsik
sevcsik / nodejs-angularjs-common-modules.md
Last active February 15, 2022 09:38
Sharing modules between NodeJS and AngularJS

They say that one of the pros of NodeJS is that you use the same language on the back-end and the front-end, so it's easy to share code between them. This sounds great in theory, but in practice the synchronous dependency handling in NodeJS works completely different than any client-side frameworks (which are asynchronous).

Usually that means that you end up copy-pasting your code between your NodeJS sources and your client-side sources, or you use some tool like Browserify, which is brilliant, but they add an extra step in the build process and most likely will conflict with the dependency handling of the framework of your choice (like AnularJS DI). I couldn't look in the mirror if I would call that code sharing.

Fortunately, with a couple of lines of boilerplate code, you can write a module which works in NodeJS and AngularJS as well without any modification.

No globals in the front-end, and dependencies will work. The isNode and isAngular va

@ekoneil
ekoneil / gist:6813974
Last active December 24, 2015 14:39
[Facebook iOS SDK example] Publish an Open Graph (OG) story that: 1/ uses image staging 2/ creates a custom, user-owned OG object 3/ creates a custom OG action
UIImage* image = [UIImage imageNamed:@"inspiration-2.jpg"]; // image stored in app's resources
// stage an image
[FBRequestConnection startForUploadStagingResourceWithImage:image
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if(error) {
NSLog(@"Error staging resource.\n%@", error);
int code = [[[[[error userInfo] objectForKey:@"com.facebook.sdk:ParsedJSONResponseKey"] objectForKey:@"body"] objectForKey:@"error"] objectForKey:@"code"];
if(code == 2500) {
@joshbeckman
joshbeckman / animatedScrollTo.js
Created September 30, 2013 14:51
ScrollTo animation using pure javascript and no jquery
document.getElementsByTagName('button')[0].onclick = function () {
scrollTo(document.body, 0, 1250);
}
function scrollTo(element, to, duration) {
var start = element.scrollTop,
change = to - start,
currentTime = 0,
increment = 20;